Skip to content

Commit

Permalink
fix(miner): fix new bug in StateMinerPreCommitDepositForPower calcula…
Browse files Browse the repository at this point in the history
…tion (#12595)

Regression introduced by refactoring in
#12384 where the NV16 special
case was missed and the full sector weight calculation was applied. The lack of
this special case essentially reverts FIP-0034 for this API, but not for actors
which would have a different PCD calculation.
  • Loading branch information
rvagg authored and rjan90 committed Oct 14, 2024
1 parent 171c2ff commit a2fd927
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions node/impl/full/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1504,9 +1504,17 @@ func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr
return types.EmptyInt, xerrors.Errorf("loading reward actor state: %w", err)
}

sectorWeight, err := a.calculateSectorWeight(ctx, maddr, pci, ts.Height(), state)
if err != nil {
return types.EmptyInt, err
var sectorWeight abi.StoragePower
if a.StateManager.GetNetworkVersion(ctx, ts.Height()) <= network.Version16 {
if sectorWeight, err = a.calculateSectorWeight(ctx, maddr, pci, ts.Height(), state); err != nil {
return types.EmptyInt, err
}
} else {
ssize, err := pci.SealProof.SectorSize()
if err != nil {
return types.EmptyInt, xerrors.Errorf("failed to resolve sector size for seal proof: %w", err)
}
sectorWeight = miner.QAPowerMax(ssize)
}

_, powerSmoothed, err := a.pledgeCalculationInputs(ctx, state)
Expand Down

0 comments on commit a2fd927

Please sign in to comment.