Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(shed): improve termination-estimate CLI for delegated owner addresses #12569

Merged
merged 5 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading