diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eb4b413718..7fdd3d9474f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ # UNRELEASED - Improve eth filter performance for nodes serving many clients. ([filecoin-project/lotus#12603](https://github.com/filecoin-project/lotus/pull/12603)) +## 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)) + ## Bug Fixes - Make `EthTraceFilter` / `trace_filter` skip null rounds instead of erroring. ([filecoin-project/lotus#12702](https://github.com/filecoin-project/lotus/pull/12702)) diff --git a/chain/actors/builtin/builtin.go b/chain/actors/builtin/builtin.go index 7278b3f0849..48254dcc699 100644 --- a/chain/actors/builtin/builtin.go +++ b/chain/actors/builtin/builtin.go @@ -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" @@ -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 { diff --git a/chain/actors/builtin/builtin.go.template b/chain/actors/builtin/builtin.go.template index 86eb1277588..52bd34c4751 100644 --- a/chain/actors/builtin/builtin.go.template +++ b/chain/actors/builtin/builtin.go.template @@ -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" ) @@ -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 { diff --git a/chain/actors/builtin/market/actor.go.template b/chain/actors/builtin/market/actor.go.template index f913cb0abaa..d4f20acec12 100644 --- a/chain/actors/builtin/market/actor.go.template +++ b/chain/actors/builtin/market/actor.go.template @@ -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) diff --git a/chain/actors/builtin/market/market.go b/chain/actors/builtin/market/market.go index 1cbde5d4e06..77450fe39d6 100644 --- a/chain/actors/builtin/market/market.go +++ b/chain/actors/builtin/market/market.go @@ -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) diff --git a/chain/actors/builtin/market/state.go.template b/chain/actors/builtin/market/state.go.template index 19f2c17aba1..2b4bc25bd3c 100644 --- a/chain/actors/builtin/market/state.go.template +++ b/chain/actors/builtin/market/state.go.template @@ -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) { diff --git a/chain/actors/builtin/market/v0.go b/chain/actors/builtin/market/v0.go index cd207ac2c03..63e0a2c0651 100644 --- a/chain/actors/builtin/market/v0.go +++ b/chain/actors/builtin/market/v0.go @@ -125,9 +125,9 @@ func (s *state0) LockedTable() (BalanceTable, error) { func (s *state0) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, err := market0.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, err := market0.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state0) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v10.go b/chain/actors/builtin/market/v10.go index 9d6e9798966..75dd2b59594 100644 --- a/chain/actors/builtin/market/v10.go +++ b/chain/actors/builtin/market/v10.go @@ -124,9 +124,9 @@ func (s *state10) LockedTable() (BalanceTable, error) { func (s *state10) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market10.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market10.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state10) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v11.go b/chain/actors/builtin/market/v11.go index 69620f558f7..aaaa38e382a 100644 --- a/chain/actors/builtin/market/v11.go +++ b/chain/actors/builtin/market/v11.go @@ -124,9 +124,9 @@ func (s *state11) LockedTable() (BalanceTable, error) { func (s *state11) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market11.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market11.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state11) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v12.go b/chain/actors/builtin/market/v12.go index 7ae77760516..236ba976042 100644 --- a/chain/actors/builtin/market/v12.go +++ b/chain/actors/builtin/market/v12.go @@ -124,9 +124,9 @@ func (s *state12) LockedTable() (BalanceTable, error) { func (s *state12) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market12.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market12.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state12) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v13.go b/chain/actors/builtin/market/v13.go index 6a5f5877819..ac450166a54 100644 --- a/chain/actors/builtin/market/v13.go +++ b/chain/actors/builtin/market/v13.go @@ -124,9 +124,9 @@ func (s *state13) LockedTable() (BalanceTable, error) { func (s *state13) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market13.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market13.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state13) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v14.go b/chain/actors/builtin/market/v14.go index 0eea2375f9e..37564331999 100644 --- a/chain/actors/builtin/market/v14.go +++ b/chain/actors/builtin/market/v14.go @@ -124,9 +124,9 @@ func (s *state14) LockedTable() (BalanceTable, error) { func (s *state14) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market14.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market14.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state14) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v15.go b/chain/actors/builtin/market/v15.go index 7de7ef1c426..950f2174e0b 100644 --- a/chain/actors/builtin/market/v15.go +++ b/chain/actors/builtin/market/v15.go @@ -124,9 +124,9 @@ func (s *state15) LockedTable() (BalanceTable, error) { func (s *state15) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market15.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market15.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state15) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v2.go b/chain/actors/builtin/market/v2.go index 3c1f376ecdc..d633707839e 100644 --- a/chain/actors/builtin/market/v2.go +++ b/chain/actors/builtin/market/v2.go @@ -125,9 +125,9 @@ func (s *state2) LockedTable() (BalanceTable, error) { func (s *state2) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market2.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market2.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state2) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v3.go b/chain/actors/builtin/market/v3.go index 7e8d60fea19..dc80232468a 100644 --- a/chain/actors/builtin/market/v3.go +++ b/chain/actors/builtin/market/v3.go @@ -120,9 +120,9 @@ func (s *state3) LockedTable() (BalanceTable, error) { func (s *state3) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market3.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market3.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state3) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v4.go b/chain/actors/builtin/market/v4.go index 08beaf51588..d12d37968c2 100644 --- a/chain/actors/builtin/market/v4.go +++ b/chain/actors/builtin/market/v4.go @@ -120,9 +120,9 @@ func (s *state4) LockedTable() (BalanceTable, error) { func (s *state4) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market4.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market4.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state4) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v5.go b/chain/actors/builtin/market/v5.go index 93a05355de0..d22c69bddbc 100644 --- a/chain/actors/builtin/market/v5.go +++ b/chain/actors/builtin/market/v5.go @@ -120,9 +120,9 @@ func (s *state5) LockedTable() (BalanceTable, error) { func (s *state5) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market5.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market5.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state5) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v6.go b/chain/actors/builtin/market/v6.go index ec91573184e..6aea7489bca 100644 --- a/chain/actors/builtin/market/v6.go +++ b/chain/actors/builtin/market/v6.go @@ -122,9 +122,9 @@ func (s *state6) LockedTable() (BalanceTable, error) { func (s *state6) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market6.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market6.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state6) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v7.go b/chain/actors/builtin/market/v7.go index 5e49fb5dad3..0adb5a24570 100644 --- a/chain/actors/builtin/market/v7.go +++ b/chain/actors/builtin/market/v7.go @@ -122,9 +122,9 @@ func (s *state7) LockedTable() (BalanceTable, error) { func (s *state7) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market7.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market7.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state7) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v8.go b/chain/actors/builtin/market/v8.go index 0ea4bf84b0f..55c063734d2 100644 --- a/chain/actors/builtin/market/v8.go +++ b/chain/actors/builtin/market/v8.go @@ -123,9 +123,9 @@ func (s *state8) LockedTable() (BalanceTable, error) { func (s *state8) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market8.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market8.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state8) NextID() (abi.DealID, error) { diff --git a/chain/actors/builtin/market/v9.go b/chain/actors/builtin/market/v9.go index 7805efca23d..0915983ab1a 100644 --- a/chain/actors/builtin/market/v9.go +++ b/chain/actors/builtin/market/v9.go @@ -124,9 +124,9 @@ func (s *state9) LockedTable() (BalanceTable, error) { func (s *state9) VerifyDealsForActivation( minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch, -) (weight, verifiedWeight abi.DealWeight, err error) { - w, vw, _, err := market9.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) - return w, vw, err +) (verifiedWeight abi.DealWeight, err error) { + _, vw, _, err := market9.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch) + return vw, err } func (s *state9) NextID() (abi.DealID, error) { diff --git a/chain/gen/genesis/miners.go b/chain/gen/genesis/miners.go index 69e8ccb8457..895e4efd2d8 100644 --- a/chain/gen/genesis/miners.go +++ b/chain/gen/genesis/miners.go @@ -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) } diff --git a/itests/migration_test.go b/itests/migration_test.go index d57758be852..fffa24297da 100644 --- a/itests/migration_test.go +++ b/itests/migration_test.go @@ -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) diff --git a/node/impl/full/state.go b/node/impl/full/state.go index 05a65cd0484..74adf72b215 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -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 @@ -1640,7 +1640,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 {