Skip to content

Commit

Permalink
fix(lotus-shed): improve termination-estimate CLI for delegated owner…
Browse files Browse the repository at this point in the history
… addresses (#12569)

- Add logic to check if the miner's owner address is delegated.
- If it is delegated, the command now sends the termination state call using the worker ID.
  • Loading branch information
GrapeInTheTree authored Oct 14, 2024
1 parent 54f68cb commit f6d4fc7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
## Bug Fixes
- Fix a bug in the `lotus-shed indexes backfill-events` command that may result in either duplicate events being backfilled where there are existing events (such an operation *should* be idempotent) or events erroneously having duplicate `logIndex` values when queried via ETH APIs. ([filecoin-project/lotus#12567](https://github.com/filecoin-project/lotus/pull/12567))
- Event APIs (Eth events and actor events) should only return reverted events if client queries by specific block hash / tipset. Eth and actor event subscription APIs should always return reverted events to enable accurate observation of real-time changes. ([filecoin-project/lotus#12585](https://github.com/filecoin-project/lotus/pull/12585))
- Add logic to check if the miner's owner address is delegated (f4 address). If it is delegated, the `lotus-shed sectors termination-estimate` command now sends the termination state call using the worker ID. This fix resolves the issue where termination-estimate did not function correctly for miners with delegated owner addresses. ([filecoin-project/lotus#12569](https://github.com/filecoin-project/lotus/pull/12569))

## Improvements

Expand Down
14 changes: 13 additions & 1 deletion cmd/lotus-shed/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ var terminateSectorPenaltyEstimationCmd = &cli.Command{
return err
}

ownerAddr, err := nodeApi.StateAccountKey(ctx, mi.Owner, types.EmptyTSK)
if err != nil {
ownerAddr = mi.Owner
}

var fromAddr address.Address
if ownerAddr.Protocol() == address.Delegated {
fromAddr = mi.Worker
} else {
fromAddr = mi.Owner
}

terminationDeclarationParams := []miner2.TerminationDeclaration{}

for _, sn := range cctx.Args().Slice() {
Expand Down Expand Up @@ -159,7 +171,7 @@ var terminateSectorPenaltyEstimationCmd = &cli.Command{
}

msg := &types.Message{
From: mi.Owner,
From: fromAddr,
To: maddr,
Method: builtin.MethodsMiner.TerminateSectors,

Expand Down

0 comments on commit f6d4fc7

Please sign in to comment.