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
+6 -6
View File
@@ -552,7 +552,7 @@ var sealBenchCmd = &cli.Command{
if !skipc2 {
log.Info("generating winning post candidates")
wipt, err := spt(sectorSize).RegisteredWinningPoStProof()
wipt, err := spt(sectorSize, false).RegisteredWinningPoStProof()
if err != nil {
return err
}
@@ -770,7 +770,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
Miner: mid,
Number: i,
},
ProofType: spt(sectorSize),
ProofType: spt(sectorSize, false),
}
start := time.Now()
@@ -802,7 +802,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
Miner: mid,
Number: i,
},
ProofType: spt(sectorSize),
ProofType: spt(sectorSize, false),
}
start := time.Now()
@@ -1013,7 +1013,7 @@ var proveCmd = &cli.Command{
Miner: abi.ActorID(mid),
Number: abi.SectorNumber(c2in.SectorNum),
},
ProofType: spt(abi.SectorSize(c2in.SectorSize)),
ProofType: spt(abi.SectorSize(c2in.SectorSize), false),
}
fmt.Printf("----\nstart proof computation\n")
@@ -1044,8 +1044,8 @@ func bps(sectorSize abi.SectorSize, sectorNum int, d time.Duration) string {
return types.SizeStr(types.BigInt{Int: bps}) + "/s"
}
func spt(ssize abi.SectorSize) abi.RegisteredSealProof {
spt, err := miner.SealProofTypeFromSectorSize(ssize, build.TestNetworkVersion)
func spt(ssize abi.SectorSize, synth bool) abi.RegisteredSealProof {
spt, err := miner.SealProofTypeFromSectorSize(ssize, build.TestNetworkVersion, synth)
if err != nil {
panic(err)
}
+28 -12
View File
@@ -186,7 +186,7 @@ var simpleAddPiece = &cli.Command{
Miner: mid,
Number: 1,
},
ProofType: spt(sectorSize),
ProofType: spt(sectorSize, false),
}
data, err := os.Open(cctx.Args().First())
@@ -223,6 +223,10 @@ var simplePreCommit1 = &cli.Command{
Usage: "pass miner address (only necessary if using existing sectorbuilder)",
Value: "t01000",
},
&cli.BoolFlag{
Name: "synthetic",
Usage: "generate synthetic PoRep proofs",
},
},
ArgsUsage: "[unsealed] [sealed] [cache] [[piece cid] [piece size]]...",
Action: func(cctx *cli.Context) error {
@@ -259,7 +263,7 @@ var simplePreCommit1 = &cli.Command{
Miner: mid,
Number: 1,
},
ProofType: spt(sectorSize),
ProofType: spt(sectorSize, cctx.Bool("synthetic")),
}
var ticket [32]byte // all zero
@@ -297,6 +301,10 @@ var simplePreCommit2 = &cli.Command{
Usage: "pass miner address (only necessary if using existing sectorbuilder)",
Value: "t01000",
},
&cli.BoolFlag{
Name: "synthetic",
Usage: "generate synthetic PoRep proofs",
},
},
ArgsUsage: "[sealed] [cache] [pc1 out]",
Action: func(cctx *cli.Context) error {
@@ -337,7 +345,7 @@ var simplePreCommit2 = &cli.Command{
Miner: mid,
Number: 1,
},
ProofType: spt(sectorSize),
ProofType: spt(sectorSize, cctx.Bool("synthetic")),
}
start := time.Now()
@@ -368,6 +376,10 @@ var simpleCommit1 = &cli.Command{
Usage: "pass miner address (only necessary if using existing sectorbuilder)",
Value: "t01000",
},
&cli.BoolFlag{
Name: "synthetic",
Usage: "generate synthetic PoRep proofs",
},
},
ArgsUsage: "[sealed] [cache] [comm D] [comm R] [c1out.json]",
Action: func(cctx *cli.Context) error {
@@ -403,7 +415,7 @@ var simpleCommit1 = &cli.Command{
Miner: mid,
Number: 1,
},
ProofType: spt(sectorSize),
ProofType: spt(sectorSize, cctx.Bool("synthetic")),
}
start := time.Now()
@@ -469,6 +481,10 @@ var simpleCommit2 = &cli.Command{
Usage: "pass miner address (only necessary if using existing sectorbuilder)",
Value: "t01000",
},
&cli.BoolFlag{
Name: "synthetic",
Usage: "generate synthetic PoRep proofs",
},
},
Action: func(c *cli.Context) error {
if c.Bool("no-gpu") {
@@ -515,7 +531,7 @@ var simpleCommit2 = &cli.Command{
Miner: abi.ActorID(mid),
Number: abi.SectorNumber(c2in.SectorNum),
},
ProofType: spt(abi.SectorSize(c2in.SectorSize)),
ProofType: spt(abi.SectorSize(c2in.SectorSize), c.Bool("synthetic")),
}
start := time.Now()
@@ -573,7 +589,7 @@ var simpleWindowPost = &cli.Command{
return xerrors.Errorf("parse commr: %w", err)
}
wpt, err := spt(sectorSize).RegisteredWindowPoStProof()
wpt, err := spt(sectorSize, false).RegisteredWindowPoStProof()
if err != nil {
return err
}
@@ -593,7 +609,7 @@ var simpleWindowPost = &cli.Command{
vp, err := ffi.GenerateSingleVanillaProof(ffi.PrivateSectorInfo{
SectorInfo: prf.SectorInfo{
SealProof: spt(sectorSize),
SealProof: spt(sectorSize, false),
SectorNumber: sn,
SealedCID: commr,
},
@@ -660,7 +676,7 @@ var simpleWinningPost = &cli.Command{
return xerrors.Errorf("parse commr: %w", err)
}
wpt, err := spt(sectorSize).RegisteredWinningPoStProof()
wpt, err := spt(sectorSize, false).RegisteredWinningPoStProof()
if err != nil {
return err
}
@@ -680,7 +696,7 @@ var simpleWinningPost = &cli.Command{
vp, err := ffi.GenerateSingleVanillaProof(ffi.PrivateSectorInfo{
SectorInfo: prf.SectorInfo{
SealProof: spt(sectorSize),
SealProof: spt(sectorSize, false),
SectorNumber: sn,
SealedCID: commr,
},
@@ -763,7 +779,7 @@ var simpleReplicaUpdate = &cli.Command{
Miner: mid,
Number: 1,
},
ProofType: spt(sectorSize),
ProofType: spt(sectorSize, false),
}
start := time.Now()
@@ -831,7 +847,7 @@ var simpleProveReplicaUpdate1 = &cli.Command{
Miner: mid,
Number: 1,
},
ProofType: spt(sectorSize),
ProofType: spt(sectorSize, false),
}
start := time.Now()
@@ -918,7 +934,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{
Miner: mid,
Number: 1,
},
ProofType: spt(sectorSize),
ProofType: spt(sectorSize, false),
}
start := time.Now()
+139 -1
View File
@@ -21,6 +21,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/builtin"
minerV12 "github.com/filecoin-project/go-state-types/builtin/v12/miner"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/network"
@@ -49,6 +50,7 @@ var actorCmd = &cli.Command{
actorProposeChangeWorker,
actorConfirmChangeWorker,
actorCompactAllocatedCmd,
actorMovePartitionsCmd,
actorProposeChangeBeneficiary,
actorConfirmChangeBeneficiary,
},
@@ -1286,13 +1288,149 @@ var actorConfirmChangeBeneficiary = &cli.Command{
},
}
var actorMovePartitionsCmd = &cli.Command{
Name: "move-partitions",
Usage: "move deadline of specified partitions from one to another",
Flags: []cli.Flag{
&cli.Int64SliceFlag{
Name: "partition-indices",
Usage: "Indices of partitions to update, separated by comma",
},
&cli.Uint64Flag{
Name: "orig-deadline",
Usage: "Deadline to move partition from",
},
&cli.Uint64Flag{
Name: "dest-deadline",
Usage: "Deadline to move partition to",
},
&cli.BoolFlag{
Name: "really-do-it",
Usage: "Actually send transaction performing the action",
Value: false,
},
},
Action: func(cctx *cli.Context) error {
if !cctx.Bool("really-do-it") {
fmt.Println("Pass --really-do-it to actually execute this action")
return nil
}
if cctx.Args().Present() {
return fmt.Errorf("please use flags to provide arguments")
}
ctx := lcli.ReqContext(cctx)
minerApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
maddr, err := minerApi.ActorAddress(ctx)
if err != nil {
return err
}
fmt.Printf("Miner: %s\n", color.BlueString("%s", maddr))
fullNodeApi, acloser, err := lcli.GetFullNodeAPI(cctx)
if err != nil {
return err
}
defer acloser()
minfo, err := fullNodeApi.StateMinerInfo(ctx, maddr, types.EmptyTSK)
if err != nil {
return err
}
origDeadline := cctx.Uint64("orig-deadline")
if origDeadline > miner.WPoStPeriodDeadlines {
return fmt.Errorf("orig-deadline %d out of range", origDeadline)
}
destDeadline := cctx.Uint64("dest-deadline")
if destDeadline > miner.WPoStPeriodDeadlines {
return fmt.Errorf("dest-deadline %d out of range", destDeadline)
}
if origDeadline == destDeadline {
return fmt.Errorf("dest-desdline cannot be the same as orig-deadline")
}
partitions := cctx.Int64Slice("partition-indices")
if len(partitions) == 0 {
return fmt.Errorf("must include at least one partition to move")
}
curPartitions, err := fullNodeApi.StateMinerPartitions(ctx, maddr, origDeadline, types.EmptyTSK)
if err != nil {
return fmt.Errorf("getting partitions for deadline %d: %w", origDeadline, err)
}
if len(partitions) > len(curPartitions) {
return fmt.Errorf("partition size(%d) cannot be bigger than current partition size(%d) for deadline %d", len(partitions), len(curPartitions), origDeadline)
}
fmt.Printf("Moving %d paritions\n", len(partitions))
partitionsBf := bitfield.New()
for _, partition := range partitions {
if partition >= int64(len(curPartitions)) {
return fmt.Errorf("partition index(%d) doesn't exist", partition)
}
partitionsBf.Set(uint64(partition))
}
params := minerV12.MovePartitionsParams{
OrigDeadline: origDeadline,
DestDeadline: destDeadline,
Partitions: partitionsBf,
}
serializedParams, err := actors.SerializeParams(&params)
if err != nil {
return fmt.Errorf("serializing params: %w", err)
}
smsg, err := fullNodeApi.MpoolPushMessage(ctx, &types.Message{
From: minfo.Worker,
To: maddr,
Method: builtin.MethodsMiner.MovePartitions,
Value: big.Zero(),
Params: serializedParams,
}, nil)
if err != nil {
return fmt.Errorf("mpool push: %w", err)
}
fmt.Println("MovePartitions Message CID:", smsg.Cid())
// wait for it to get mined into a block
fmt.Println("Waiting for block confirmation...")
wait, err := fullNodeApi.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence)
if err != nil {
return err
}
// check it executed successfully
if wait.Receipt.ExitCode.IsError() {
fmt.Println("Moving partitions failed!")
return err
}
fmt.Println("Move partition confirmed")
return nil
},
}
var actorCompactAllocatedCmd = &cli.Command{
Name: "compact-allocated",
Usage: "compact allocated sectors bitfield",
Flags: []cli.Flag{
&cli.Uint64Flag{
Name: "mask-last-offset",
Usage: "Mask sector IDs from 0 to 'higest_allocated - offset'",
Usage: "Mask sector IDs from 0 to 'highest_allocated - offset'",
},
&cli.Uint64Flag{
Name: "mask-upto-n",
+2 -3
View File
@@ -7,7 +7,6 @@ import (
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/urfave/cli/v2"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/specs-actors/v7/actors/util/adt"
"github.com/filecoin-project/lotus/blockstore"
@@ -39,8 +38,8 @@ var sectorPreCommitsCmd = &cli.Command{
if err != nil {
return err
}
preCommitSector := make([]minertypes.SectorPreCommitOnChainInfo, 0)
err = mst.ForEachPrecommittedSector(func(info minertypes.SectorPreCommitOnChainInfo) error {
preCommitSector := make([]miner.SectorPreCommitOnChainInfo, 0)
err = mst.ForEachPrecommittedSector(func(info miner.SectorPreCommitOnChainInfo) error {
preCommitSector = append(preCommitSector, info)
return err
})
+32 -18
View File
@@ -24,14 +24,13 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/builtin/verifreg"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types"
@@ -193,14 +192,14 @@ var sectorsStatusCmd = &cli.Command{
}
tbs := blockstore.NewTieredBstore(blockstore.NewAPIBlockstore(fullApi), blockstore.NewMemory())
mas, err := lminer.Load(adt.WrapStore(ctx, cbor.NewCborStore(tbs)), mact)
mas, err := miner.Load(adt.WrapStore(ctx, cbor.NewCborStore(tbs)), mact)
if err != nil {
return err
}
errFound := errors.New("found")
if err := mas.ForEachDeadline(func(dlIdx uint64, dl lminer.Deadline) error {
return dl.ForEachPartition(func(partIdx uint64, part lminer.Partition) error {
if err := mas.ForEachDeadline(func(dlIdx uint64, dl miner.Deadline) error {
return dl.ForEachPartition(func(partIdx uint64, part miner.Partition) error {
pas, err := part.AllSectors()
if err != nil {
return err
@@ -847,7 +846,12 @@ var sectorsCheckExpireCmd = &cli.Command{
for _, sector := range sectors {
MaxExpiration := sector.Activation + policy.GetSectorMaxLifetime(sector.SealProof, nv)
MaxExtendNow := currEpoch + policy.GetMaxSectorExpirationExtension()
maxExtension, err := policy.GetMaxSectorExpirationExtension(nv)
if err != nil {
return xerrors.Errorf("failed to get max extension: %w", err)
}
MaxExtendNow := currEpoch + maxExtension
if MaxExtendNow > MaxExpiration {
MaxExtendNow = MaxExpiration
@@ -1075,22 +1079,22 @@ var sectorsExtendCmd = &cli.Command{
tbs := blockstore.NewTieredBstore(blockstore.NewAPIBlockstore(fullApi), blockstore.NewMemory())
adtStore := adt.WrapStore(ctx, cbor.NewCborStore(tbs))
mas, err := lminer.Load(adtStore, mact)
mas, err := miner.Load(adtStore, mact)
if err != nil {
return err
}
activeSectorsLocation := make(map[abi.SectorNumber]*lminer.SectorLocation, len(activeSet))
activeSectorsLocation := make(map[abi.SectorNumber]*miner.SectorLocation, len(activeSet))
if err := mas.ForEachDeadline(func(dlIdx uint64, dl lminer.Deadline) error {
return dl.ForEachPartition(func(partIdx uint64, part lminer.Partition) error {
if err := mas.ForEachDeadline(func(dlIdx uint64, dl miner.Deadline) error {
return dl.ForEachPartition(func(partIdx uint64, part miner.Partition) error {
pas, err := part.ActiveSectors()
if err != nil {
return err
}
return pas.ForEach(func(i uint64) error {
activeSectorsLocation[abi.SectorNumber(i)] = &lminer.SectorLocation{
activeSectorsLocation[abi.SectorNumber(i)] = &miner.SectorLocation{
Deadline: dlIdx,
Partition: partIdx,
}
@@ -1177,7 +1181,7 @@ var sectorsExtendCmd = &cli.Command{
return diff <= abi.ChainEpoch(cctx.Int64("tolerance"))
}
extensions := map[lminer.SectorLocation]map[abi.ChainEpoch][]abi.SectorNumber{}
extensions := map[miner.SectorLocation]map[abi.ChainEpoch][]abi.SectorNumber{}
for _, si := range sis {
extension := abi.ChainEpoch(cctx.Int64("extension"))
newExp := si.Expiration + extension
@@ -1186,7 +1190,12 @@ var sectorsExtendCmd = &cli.Command{
newExp = abi.ChainEpoch(cctx.Int64("new-expiration"))
}
maxExtendNow := currEpoch + policy.GetMaxSectorExpirationExtension()
maxExtension, err := policy.GetMaxSectorExpirationExtension(nv)
if err != nil {
return xerrors.Errorf("failed to get max extension: %w", err)
}
maxExtendNow := currEpoch + maxExtension
if newExp > maxExtendNow {
newExp = maxExtendNow
}
@@ -1741,7 +1750,7 @@ var sectorsCapacityCollateralCmd = &cli.Command{
return err
}
spt, err := lminer.PreferredSealProofTypeFromWindowPoStType(nv, mi.WindowPoStProofType)
spt, err := miner.PreferredSealProofTypeFromWindowPoStType(nv, mi.WindowPoStProofType, false)
if err != nil {
return err
}
@@ -1756,7 +1765,12 @@ var sectorsCapacityCollateralCmd = &cli.Command{
return err
}
pci.Expiration = policy.GetMaxSectorExpirationExtension() + h.Height()
maxExtension, err := policy.GetMaxSectorExpirationExtension(nv)
if err != nil {
return xerrors.Errorf("failed to get max extension: %w", err)
}
pci.Expiration = maxExtension + h.Height()
}
pc, err := nApi.StateMinerInitialPledgeCollateral(ctx, maddr, pci, types.EmptyTSK)
@@ -1910,7 +1924,7 @@ var sectorsExpiredCmd = &cli.Command{
}
tbs := blockstore.NewTieredBstore(blockstore.NewAPIBlockstore(fullApi), blockstore.NewMemory())
mas, err := lminer.Load(adt.WrapStore(ctx, cbor.NewCborStore(tbs)), mact)
mas, err := miner.Load(adt.WrapStore(ctx, cbor.NewCborStore(tbs)), mact)
if err != nil {
return err
}
@@ -1926,8 +1940,8 @@ var sectorsExpiredCmd = &cli.Command{
return xerrors.Errorf("intersecting bitfields: %w", err)
}
if err := mas.ForEachDeadline(func(dlIdx uint64, dl lminer.Deadline) error {
return dl.ForEachPartition(func(partIdx uint64, part lminer.Partition) error {
if err := mas.ForEachDeadline(func(dlIdx uint64, dl miner.Deadline) error {
return dl.ForEachPartition(func(partIdx uint64, part miner.Partition) error {
live, err := part.LiveSectors()
if err != nil {
return err
+3 -1
View File
@@ -137,7 +137,9 @@ var preSealCmd = &cli.Command{
nv = network.Version(c.Uint64("network-version"))
}
spt, err := miner.SealProofTypeFromSectorSize(sectorSize, nv)
var synthetic = false // there's little reason to have this for a seed.
spt, err := miner.SealProofTypeFromSectorSize(sectorSize, nv, synthetic)
if err != nil {
return err
}
+22
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/signal"
"runtime/pprof"
logging "github.com/ipfs/go-log/v2"
"github.com/urfave/cli/v2"
@@ -116,10 +117,31 @@ func main() {
Name: "log-level",
Value: "info",
},
&cli.StringFlag{
Name: "pprof",
Usage: "specify name of file for writing cpu profile to",
},
},
Before: func(cctx *cli.Context) error {
if prof := cctx.String("pprof"); prof != "" {
profile, err := os.Create(prof)
if err != nil {
return err
}
if err := pprof.StartCPUProfile(profile); err != nil {
return err
}
}
return logging.SetLogLevel("lotus-shed", cctx.String("log-level"))
},
After: func(cctx *cli.Context) error {
if prof := cctx.String("pprof"); prof != "" {
pprof.StopCPUProfile()
}
return nil
},
}
// terminate early on ctrl+c
+35
View File
@@ -21,6 +21,7 @@ import (
"github.com/filecoin-project/go-state-types/builtin"
v10 "github.com/filecoin-project/go-state-types/builtin/v10"
v11 "github.com/filecoin-project/go-state-types/builtin/v11"
v12 "github.com/filecoin-project/go-state-types/builtin/v12"
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
v9 "github.com/filecoin-project/go-state-types/builtin/v9"
@@ -243,6 +244,8 @@ func getMigrationFuncsForNetwork(nv network.Version) (UpgradeActorsFunc, PreUpgr
return filcns.UpgradeActorsV10, filcns.PreUpgradeActorsV10, checkNv18Invariants, nil
case network.Version19:
return filcns.UpgradeActorsV11, filcns.PreUpgradeActorsV11, checkNv19Invariants, nil
case network.Version21:
return filcns.UpgradeActorsV12, filcns.PreUpgradeActorsV12, checkNv21Invariants, nil
default:
return nil, nil, nil, xerrors.Errorf("migration not implemented for nv%d", nv)
}
@@ -252,6 +255,38 @@ type UpgradeActorsFunc = func(context.Context, *stmgr.StateManager, stmgr.Migrat
type PreUpgradeActorsFunc = func(context.Context, *stmgr.StateManager, stmgr.MigrationCache, cid.Cid, abi.ChainEpoch, *types.TipSet) error
type CheckInvariantsFunc = func(context.Context, cid.Cid, cid.Cid, blockstore.Blockstore, abi.ChainEpoch) error
func checkNv21Invariants(ctx context.Context, oldStateRootCid cid.Cid, newStateRootCid cid.Cid, bs blockstore.Blockstore, epoch abi.ChainEpoch) error {
actorStore := store.ActorStore(ctx, bs)
startTime := time.Now()
// Load the new state root.
var newStateRoot types.StateRoot
if err := actorStore.Get(ctx, newStateRootCid, &newStateRoot); err != nil {
return xerrors.Errorf("failed to decode state root: %w", err)
}
actorCodeCids, err := actors.GetActorCodeIDs(actorstypes.Version12)
if err != nil {
return err
}
newActorTree, err := builtin.LoadTree(actorStore, newStateRoot.Actors)
if err != nil {
return err
}
messages, err := v12.CheckStateInvariants(newActorTree, epoch, actorCodeCids)
if err != nil {
return xerrors.Errorf("checking state invariants: %w", err)
}
for _, message := range messages.Messages() {
fmt.Println("got the following error: ", message)
}
fmt.Println("completed invariant checks, took ", time.Since(startTime))
return nil
}
func checkNv19Invariants(ctx context.Context, oldStateRootCid cid.Cid, newStateRootCid cid.Cid, bs blockstore.Blockstore, epoch abi.ChainEpoch) error {
actorStore := store.ActorStore(ctx, bs)
+22 -7
View File
@@ -38,7 +38,7 @@ func (t *CarbNode) MarshalCBOR(w io.Writer) error {
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Sub"))); err != nil {
return err
}
if _, err := io.WriteString(w, string("Sub")); err != nil {
if _, err := cw.WriteString(string("Sub")); err != nil {
return err
}
@@ -50,9 +50,11 @@ func (t *CarbNode) MarshalCBOR(w io.Writer) error {
return err
}
for _, v := range t.Sub {
if err := cbg.WriteCid(w, v); err != nil {
return xerrors.Errorf("failed writing cid field t.Sub: %w", err)
if err := cbg.WriteCid(cw, v); err != nil {
return xerrors.Errorf("failed to write cid field v: %w", err)
}
}
return nil
}
@@ -116,12 +118,25 @@ func (t *CarbNode) 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.Sub failed: %w", err)
{
c, err := cbg.ReadCid(cr)
if err != nil {
return xerrors.Errorf("failed to read cid field t.Sub[i]: %w", err)
}
t.Sub[i] = c
}
}
t.Sub[i] = c
}
default:
@@ -165,7 +165,7 @@ func (stage *PreCommitStage) packMiner(
// Generate pre-commits.
sealType, err := miner.PreferredSealProofTypeFromWindowPoStType(
nv, minerInfo.WindowPoStProofType,
nv, minerInfo.WindowPoStProofType, false,
)
if err != nil {
return 0, false, err
@@ -176,7 +176,12 @@ func (stage *PreCommitStage) packMiner(
return 0, false, err
}
expiration := epoch + policy.GetMaxSectorExpirationExtension()
maxExtension, err := policy.GetMaxSectorExpirationExtension(nv)
if err != nil {
return 0, false, xerrors.Errorf("failed to get max extension: %w", err)
}
expiration := epoch + maxExtension
infos := make([]minertypes.PreCommitSectorParams, len(sectorNos))
for i, sno := range sectorNos {
infos[i] = minertypes.PreCommitSectorParams{