Skip to content

Commit 4e247d1

Browse files
authored
fix(cli): correctly construct the TerminateSectors params (#13207)
fix TerminateSectors
1 parent 8278179 commit 4e247d1

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
- fix(cli): make lotus-miner sectors extend command resilient to higher gas ([filecoin-project/lotus#11927](https://github.com/filecoin-project/lotus/pull/11928))
3737
- feat(api): update go-f3 to 0.8.8, add F3GetPowerTableByInstance to the API ([filecoin-project/lotus#13201](https://github.com/filecoin-project/lotus/pull/13201))
3838
- fix(cli): use F3GetPowerTableByInstance to resolve F3 power tables by default, `--by-tipset` flag can be used to restore old behavior ([filecoin-project/lotus#13201](https://github.com/filecoin-project/lotus/pull/13201))
39+
- fix(cli): correctly construct the TerminateSectors params
3940

4041
# Node v1.33.0 / 2025-05-08
4142
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/spcli/sectors.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ type TerminatorNode interface {
14131413

14141414
func TerminateSectors(ctx context.Context, full TerminatorNode, maddr address.Address, sectorNumbers []int, fromAddr address.Address) (*types.SignedMessage, error) {
14151415

1416-
terminationDeclarationParams := []miner2.TerminationDeclaration{}
1416+
terminationMap := make(map[string]*miner2.TerminationDeclaration)
14171417

14181418
for _, sectorNum := range sectorNumbers {
14191419

@@ -1425,13 +1425,21 @@ func TerminateSectors(ctx context.Context, full TerminatorNode, maddr address.Ad
14251425
return nil, fmt.Errorf("get state sector partition %s", err)
14261426
}
14271427

1428-
para := miner2.TerminationDeclaration{
1429-
Deadline: loca.Deadline,
1430-
Partition: loca.Partition,
1431-
Sectors: sectorbit,
1428+
key := fmt.Sprintf("%d-%d", loca.Deadline, loca.Partition)
1429+
if td, exists := terminationMap[key]; exists {
1430+
td.Sectors.Set(uint64(sectorNum))
1431+
} else {
1432+
terminationMap[key] = &miner2.TerminationDeclaration{
1433+
Deadline: loca.Deadline,
1434+
Partition: loca.Partition,
1435+
Sectors: sectorbit,
1436+
}
14321437
}
1438+
}
14331439

1434-
terminationDeclarationParams = append(terminationDeclarationParams, para)
1440+
terminationDeclarationParams := make([]miner2.TerminationDeclaration, 0, len(terminationMap))
1441+
for _, td := range terminationMap {
1442+
terminationDeclarationParams = append(terminationDeclarationParams, *td)
14351443
}
14361444

14371445
terminateSectorParams := &miner2.TerminateSectorsParams{

0 commit comments

Comments
 (0)