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

chore(deps): update go-state-types, adapt to QAP API changes #12445

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
- 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

## Improvements
- The miner actor builtin `QAPowerForWeight` no longer accepts the unused "dealWeight" parameter, the function signature now only takes 3 arguments: sectorSize, sectorDuration, verifiedWeight. ([filecoin-project/lotus#12445](https://github.com/filecoin-project/lotus/pull/12445))

## Deps

Expand Down
6 changes: 3 additions & 3 deletions chain/actors/builtin/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin"
minertypes "github.com/filecoin-project/go-state-types/builtin/v15/miner"
smoothingtypes "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/manifest"
"github.com/filecoin-project/go-state-types/proof"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
Expand Down Expand Up @@ -56,8 +56,8 @@ type ExtendedSectorInfo = proof.ExtendedSectorInfo
type PoStProof = proof.PoStProof
type FilterEstimate = smoothingtypes.FilterEstimate

func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower {
return minertypes.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, verifiedWeight abi.DealWeight) abi.StoragePower {
return minertypes.QAPowerForWeight(size, duration, verifiedWeight)
}

func ActorNameByCode(c cid.Cid) string {
Expand Down
6 changes: 3 additions & 3 deletions chain/actors/builtin/builtin.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/filecoin-project/lotus/chain/actors"

minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
minertypes "github.com/filecoin-project/go-state-types/builtin/v15/miner"
smoothingtypes "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing"
)

Expand Down Expand Up @@ -56,8 +56,8 @@ type ExtendedSectorInfo = proof.ExtendedSectorInfo
type PoStProof = proof.PoStProof
type FilterEstimate = smoothingtypes.FilterEstimate

func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower {
return minertypes.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, verifiedWeight abi.DealWeight) abi.StoragePower {
return minertypes.QAPowerForWeight(size, duration, verifiedWeight)
}

func ActorNameByCode(c cid.Cid) string {
Expand Down
2 changes: 1 addition & 1 deletion chain/actors/builtin/market/actor.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type State interface {
Proposals() (DealProposals, error)
VerifyDealsForActivation(
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
) (weight, verifiedWeight abi.DealWeight, err error)
) (verifiedWeight abi.DealWeight, err error)
NextID() (abi.DealID, error)
GetState() interface{}
GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error)
Expand Down
2 changes: 1 addition & 1 deletion chain/actors/builtin/market/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ type State interface {
Proposals() (DealProposals, error)
VerifyDealsForActivation(
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
) (weight, verifiedWeight abi.DealWeight, err error)
) (verifiedWeight abi.DealWeight, err error)
NextID() (abi.DealID, error)
GetState() interface{}
GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes.AllocationId, error)
Expand Down
6 changes: 3 additions & 3 deletions chain/actors/builtin/market/state.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ func (s *state{{.v}}) LockedTable() (BalanceTable, error) {

func (s *state{{.v}}) VerifyDealsForActivation(
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
) (weight, verifiedWeight abi.DealWeight, err error) {
w, vw{{if (ge .v 2)}}, _{{end}}, err := market{{.v}}.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch)
return w, vw, err
) (verifiedWeight abi.DealWeight, err error) {
_, vw{{if (ge .v 2)}}, _{{end}}, err := market{{.v}}.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch)
return vw, err
}

func (s *state{{.v}}) NextID() (abi.DealID, error) {
Expand Down
6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v0.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v10.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v11.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v12.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v13.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v14.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v15.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v2.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v3.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v4.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v5.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v6.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v7.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v8.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions chain/actors/builtin/market/v9.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion chain/gen/genesis/miners.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
}

rawPow = big.Add(rawPow, big.NewInt(int64(m.SectorSize)))
sectorWeight := builtin.QAPowerForWeight(m.SectorSize, minerInfos[i].presealExp, big.Zero(), markettypes.DealWeight(&preseal.Deal))
sectorWeight := builtin.QAPowerForWeight(m.SectorSize, minerInfos[i].presealExp, markettypes.DealWeight(&preseal.Deal))
minerInfos[i].sectorWeight = append(minerInfos[i].sectorWeight, sectorWeight)
qaPow = big.Add(qaPow, sectorWeight)
}
Expand Down
2 changes: 1 addition & 1 deletion itests/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ func preFip0081StateMinerInitialPledgeForSector(ctx context.Context, t *testing.
req.NoError(err)

verifiedWeight := big.Mul(big.NewIntUnsigned(verifiedSize), big.NewInt(int64(sectorDuration)))
sectorWeight := builtin2.QAPowerForWeight(sectorSize, sectorDuration, big.Zero(), verifiedWeight)
sectorWeight := builtin2.QAPowerForWeight(sectorSize, sectorDuration, verifiedWeight)

thisEpochBaselinePower, err := rewardState.(interface {
ThisEpochBaselinePower() (abi.StoragePower, error)
Expand Down
6 changes: 3 additions & 3 deletions node/impl/full/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1449,12 +1449,12 @@ func (a *StateAPI) calculateSectorWeight(ctx context.Context, maddr address.Addr
return types.EmptyInt, xerrors.Errorf("loading market actor: %w", err)
} else if s, err := market.Load(store, act); err != nil {
return types.EmptyInt, xerrors.Errorf("loading market actor state: %w", err)
} else if w, vw, err := s.VerifyDealsForActivation(maddr, pci.DealIDs, height, pci.Expiration); err != nil {
} else if vw, err := s.VerifyDealsForActivation(maddr, pci.DealIDs, height, pci.Expiration); err != nil {
return types.EmptyInt, xerrors.Errorf("verifying deals for activation: %w", err)
} else {
// NB: not exactly accurate, but should always lead us to *over* estimate, not under
duration := pci.Expiration - height
sectorWeight = builtin.QAPowerForWeight(ssize, duration, w, vw)
sectorWeight = builtin.QAPowerForWeight(ssize, duration, vw)
}

return sectorWeight, nil
Expand Down Expand Up @@ -1632,7 +1632,7 @@ func (a *StateAPI) StateMinerInitialPledgeForSector(ctx context.Context, sectorD
}

verifiedWeight := big.Mul(big.NewIntUnsigned(verifiedSize), big.NewInt(int64(sectorDuration)))
sectorWeight := builtin.QAPowerForWeight(sectorSize, sectorDuration, big.Zero(), verifiedWeight)
sectorWeight := builtin.QAPowerForWeight(sectorSize, sectorDuration, verifiedWeight)

epochsSinceRampStart, rampDurationEpochs, err := a.getPledgeRampParams(ctx, ts.Height(), state)
if err != nil {
Expand Down
Loading