Skip to content

Commit df4ccaa

Browse files
authored
feat(cli): lotus state active-sectors --show-partitions + CSV (#13152)
1 parent 3ebec69 commit df4ccaa

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- feat(gateway): add CORS headers if --cors is provided ([filecoin-project/lotus#13145](https://github.com/filecoin-project/lotus/pull/13145))
1919
- feat(spcli): make settle-deal optionally take deal id ranges ([filecoin-project/lotus#13146](https://github.com/filecoin-project/lotus/pull/13146))
2020
- fix(f3): properly wire up eth v2 APIs for f3 ([filecoin-project/lotus#13149](https://github.com/filecoin-project/lotus/pull/13149))
21+
- `lotus state active-sectors` now outputs CSV format and supports an optional `--show-partitions` to list active sector deadlines and partitions. ([filecoin-project/lotus#13152](https://github.com/filecoin-project/lotus/pull/13152))
2122

2223
# Node v1.33.0 / 2025-05-08
2324
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.

cli/state.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ var StateActiveSectorsCmd = &cli.Command{
301301
Name: "active-sectors",
302302
Usage: "Query the active sector set of a miner",
303303
ArgsUsage: "[minerAddress]",
304+
Flags: []cli.Flag{
305+
&cli.BoolFlag{
306+
Name: "show-partitions",
307+
Usage: "show sector deadlines and partitions",
308+
},
309+
},
304310
Action: func(cctx *cli.Context) error {
305311
api, closer, err := GetFullNodeAPI(cctx)
306312
if err != nil {
@@ -329,8 +335,23 @@ var StateActiveSectorsCmd = &cli.Command{
329335
return err
330336
}
331337

338+
showPartitions := cctx.Bool("show-partitions")
339+
header := "Sector Number, Sealed CID"
340+
if showPartitions {
341+
header = "Sector Number, Deadline, Partition, Sealed CID"
342+
}
343+
fmt.Println(header)
344+
332345
for _, s := range sectors {
333-
fmt.Printf("%d: %s\n", s.SectorNumber, s.SealedCID)
346+
if showPartitions {
347+
sp, err := api.StateSectorPartition(ctx, maddr, s.SectorNumber, ts.Key())
348+
if err != nil {
349+
return err
350+
}
351+
fmt.Printf("%d, %d, %d, %s\n", s.SectorNumber, sp.Deadline, sp.Partition, s.SealedCID)
352+
} else {
353+
fmt.Printf("%d, %s\n", s.SectorNumber, s.SealedCID)
354+
}
334355
}
335356

336357
return nil

documentation/en/cli-lotus.md

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)