diff --git a/app/submodule/chain/chaininfo_api.go b/app/submodule/chain/chaininfo_api.go index 61fcdbb0b0..189bc39340 100644 --- a/app/submodule/chain/chaininfo_api.go +++ b/app/submodule/chain/chaininfo_api.go @@ -745,6 +745,7 @@ func (cia *chainInfoAPI) StateGetNetworkParams(ctx context.Context) (*types.Netw UpgradeDragonHeight: cfg.NetworkParams.ForkUpgradeParam.UpgradeDragonHeight, UpgradePhoenixHeight: cfg.NetworkParams.ForkUpgradeParam.UpgradePhoenixHeight, UpgradeWaffleHeight: cfg.NetworkParams.ForkUpgradeParam.UpgradeWaffleHeight, + UpgradeTuktukHeight: cfg.NetworkParams.ForkUpgradeParam.UpgradeTuktukHeight, }, Eip155ChainID: cfg.NetworkParams.Eip155ChainID, } diff --git a/app/submodule/chain/miner_api.go b/app/submodule/chain/miner_api.go index 6817d2fa4f..6128633299 100644 --- a/app/submodule/chain/miner_api.go +++ b/app/submodule/chain/miner_api.go @@ -32,7 +32,7 @@ import ( "github.com/filecoin-project/venus/venus-shared/actors/builtin" _init "github.com/filecoin-project/venus/venus-shared/actors/builtin/init" "github.com/filecoin-project/venus/venus-shared/actors/builtin/market" - lminer "github.com/filecoin-project/venus/venus-shared/actors/builtin/miner" + "github.com/filecoin-project/venus/venus-shared/actors/builtin/miner" "github.com/filecoin-project/venus/venus-shared/actors/builtin/power" "github.com/filecoin-project/venus/venus-shared/actors/builtin/reward" "github.com/filecoin-project/venus/venus-shared/actors/builtin/verifreg" @@ -80,7 +80,7 @@ func (msa *minerStateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr ad // NOTE: returned info.Expiration may not be accurate in some cases, use StateSectorExpiration to get accurate // expiration epoch // return nil if sector not found -func (msa *minerStateAPI) StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorOnChainInfo, error) { +func (msa *minerStateAPI) StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error) { _, view, err := msa.Stmgr.ParentStateViewTsk(ctx, tsk) if err != nil { return nil, fmt.Errorf("loading tipset %s: %v", tsk, err) @@ -90,7 +90,7 @@ func (msa *minerStateAPI) StateSectorGetInfo(ctx context.Context, maddr address. } // StateSectorPartition finds deadline/partition with the specified sector -func (msa *minerStateAPI) StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorLocation, error) { +func (msa *minerStateAPI) StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorLocation, error) { _, view, err := msa.Stmgr.ParentStateViewTsk(ctx, tsk) if err != nil { return nil, fmt.Errorf("loadParentStateViewTsk(%s) failed:%v", tsk.String(), err) @@ -188,7 +188,7 @@ func (msa *minerStateAPI) StateMinerRecoveries(ctx context.Context, maddr addres return bitfield.BitField{}, fmt.Errorf("failed to load miner actor state: %v", err) } - return lminer.AllPartSectors(mas, lminer.Partition.RecoveringSectors) + return miner.AllPartSectors(mas, miner.Partition.RecoveringSectors) } // StateMinerFaults returns a bitfield indicating the faulty sectors of the given miner @@ -203,7 +203,7 @@ func (msa *minerStateAPI) StateMinerFaults(ctx context.Context, maddr address.Ad return bitfield.BitField{}, fmt.Errorf("failed to load miner actor state: %v", err) } - return lminer.AllPartSectors(mas, lminer.Partition.FaultySectors) + return miner.AllPartSectors(mas, miner.Partition.FaultySectors) } func (msa *minerStateAPI) StateAllMinerFaults(ctx context.Context, lookback abi.ChainEpoch, endTsk types.TipSetKey) ([]*types.Fault, error) { @@ -253,7 +253,7 @@ func (msa *minerStateAPI) StateMinerPartitions(ctx context.Context, maddr addres } var out []types.Partition - err = dl.ForEachPartition(func(_ uint64, part lminer.Partition) error { + err = dl.ForEachPartition(func(_ uint64, part miner.Partition) error { allSectors, err := part.AllSectors() if err != nil { return fmt.Errorf("getting AllSectors: %v", err) @@ -310,7 +310,7 @@ func (msa *minerStateAPI) StateMinerDeadlines(ctx context.Context, maddr address } out := make([]types.Deadline, deadlines) - if err := mas.ForEachDeadline(func(i uint64, dl lminer.Deadline) error { + if err := mas.ForEachDeadline(func(i uint64, dl miner.Deadline) error { ps, err := dl.PartitionsPoSted() if err != nil { return err @@ -333,7 +333,7 @@ func (msa *minerStateAPI) StateMinerDeadlines(ctx context.Context, maddr address } // StateMinerSectors returns info about the given miner's sectors. If the filter bitfield is nil, all sectors are included. -func (msa *minerStateAPI) StateMinerSectors(ctx context.Context, maddr address.Address, sectorNos *bitfield.BitField, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) { +func (msa *minerStateAPI) StateMinerSectors(ctx context.Context, maddr address.Address, sectorNos *bitfield.BitField, tsk types.TipSetKey) ([]*miner.SectorOnChainInfo, error) { _, view, err := msa.Stmgr.ParentStateViewTsk(ctx, tsk) if err != nil { return nil, fmt.Errorf("Stmgr.ParentStateViewTsk failed:%v", err) @@ -715,6 +715,57 @@ var ( initialPledgeDen = big.NewInt(100) ) +func (msa *minerStateAPI) calculateSectorWeight(ctx context.Context, maddr address.Address, pci miner.SectorPreCommitInfo, height abi.ChainEpoch, state *tree.State) (abi.StoragePower, error) { + ssize, err := pci.SealProof.SectorSize() + if err != nil { + return types.EmptyInt, fmt.Errorf("failed to resolve sector size for seal proof: %w", err) + } + + store := msa.ChainReader.Store(ctx) + + var sectorWeight abi.StoragePower + if act, found, err := state.GetActor(ctx, market.Address); err != nil { + return types.EmptyInt, fmt.Errorf("loading market actor: %w", err) + } else if !found { + return types.EmptyInt, fmt.Errorf("market actor not found") + } else if s, err := market.Load(store, act); err != nil { + return types.EmptyInt, fmt.Errorf("loading market actor state: %w", err) + } else if w, vw, err := s.VerifyDealsForActivation(maddr, pci.DealIDs, height, pci.Expiration); err != nil { + return types.EmptyInt, fmt.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) + } + + return sectorWeight, nil +} + +func (msa *minerStateAPI) pledgeCalculationInputs(ctx context.Context, state tree.Tree) (abi.TokenAmount, *builtin.FilterEstimate, error) { + store := msa.ChainReader.Store(ctx) + + var ( + powerSmoothed builtin.FilterEstimate + pledgeCollateral abi.TokenAmount + ) + if act, found, err := state.GetActor(ctx, power.Address); err != nil { + return types.EmptyInt, nil, fmt.Errorf("loading power actor: %w", err) + } else if !found { + return types.EmptyInt, nil, fmt.Errorf("power actor not found") + } else if s, err := power.Load(store, act); err != nil { + return types.EmptyInt, nil, fmt.Errorf("loading power actor state: %w", err) + } else if p, err := s.TotalPowerSmoothed(); err != nil { + return types.EmptyInt, nil, fmt.Errorf("failed to determine total power: %w", err) + } else if c, err := s.TotalLocked(); err != nil { + return types.EmptyInt, nil, fmt.Errorf("failed to determine pledge collateral: %w", err) + } else { + powerSmoothed = p + pledgeCollateral = c + } + + return pledgeCollateral, &powerSmoothed, nil +} + // StateMinerPreCommitDepositForPower returns the precommit deposit for the specified miner's sector func (msa *minerStateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) { ts, err := msa.ChainReader.GetTipSet(ctx, tsk) @@ -728,56 +779,35 @@ func (msa *minerStateAPI) StateMinerPreCommitDepositForPower(ctx context.Context return big.Int{}, fmt.Errorf("ParentState failed:%v", err) } - ssize, err := pci.SealProof.SectorSize() + rewardActor, found, err := sTree.GetActor(ctx, reward.Address) if err != nil { - return big.Int{}, fmt.Errorf("failed to get resolve size: %v", err) + return types.EmptyInt, fmt.Errorf("loading reward actor: %w", err) } - - store := msa.ChainReader.Store(ctx) - var sectorWeight abi.StoragePower - if msa.Fork.GetNetworkVersion(ctx, ts.Height()) <= network.Version16 { - if act, found, err := sTree.GetActor(ctx, market.Address); err != nil || !found { - return big.Int{}, fmt.Errorf("loading market actor %s: %v", maddr, err) - } else if s, err := market.Load(store, act); err != nil { - return big.Int{}, fmt.Errorf("loading market actor state %s: %v", maddr, err) - } else if w, vw, err := s.VerifyDealsForActivation(maddr, pci.DealIDs, ts.Height(), pci.Expiration); err != nil { - return big.Int{}, fmt.Errorf("verifying deals for activation: %v", err) - } else { - // NB: not exactly accurate, but should always lead us to *over* estimate, not under - duration := pci.Expiration - ts.Height() - sectorWeight = builtin.QAPowerForWeight(ssize, duration, w, vw) - } - } else { - sectorWeight = types.QAPowerMax(ssize) + if !found { + return types.EmptyInt, fmt.Errorf("reward actor not found") } - var powerSmoothed builtin.FilterEstimate - if act, found, err := sTree.GetActor(ctx, power.Address); err != nil || !found { - return big.Int{}, fmt.Errorf("loading power actor: %v", err) - } else if s, err := power.Load(store, act); err != nil { - return big.Int{}, fmt.Errorf("loading power actor state: %v", err) - } else if p, err := s.TotalPowerSmoothed(); err != nil { - return big.Int{}, fmt.Errorf("failed to determine total power: %v", err) - } else { - powerSmoothed = p + rewardState, err := reward.Load(msa.ChainReader.Store(ctx), rewardActor) + if err != nil { + return types.EmptyInt, fmt.Errorf("loading reward actor state: %w", err) } - rewardActor, found, err := sTree.GetActor(ctx, reward.Address) - if err != nil || !found { - return big.Int{}, fmt.Errorf("loading miner actor: %v", err) + sectorWeight, err := msa.calculateSectorWeight(ctx, maddr, pci, ts.Height(), sTree) + if err != nil { + return types.EmptyInt, err } - rewardState, err := reward.Load(store, rewardActor) + _, powerSmoothed, err := msa.pledgeCalculationInputs(ctx, sTree) if err != nil { - return big.Int{}, fmt.Errorf("loading reward actor state: %v", err) + return types.EmptyInt, err } - deposit, err := rewardState.PreCommitDepositForPower(powerSmoothed, sectorWeight) + deposit, err := rewardState.PreCommitDepositForPower(*powerSmoothed, sectorWeight) if err != nil { - return big.Zero(), fmt.Errorf("calculating precommit deposit: %v", err) + return types.EmptyInt, fmt.Errorf("calculating precommit deposit: %w", err) } - return big.Div(big.Mul(deposit, initialPledgeNum), initialPledgeDen), nil + return types.BigDiv(types.BigMul(deposit, initialPledgeNum), initialPledgeDen), nil } // StateMinerInitialPledgeCollateral returns the initial pledge collateral for the specified miner's sector @@ -792,68 +822,133 @@ func (msa *minerStateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, return big.Int{}, fmt.Errorf("loading tipset(%s) parent state failed: %v", tsk, err) } - ssize, err := pci.SealProof.SectorSize() + rewardActor, found, err := state.GetActor(ctx, reward.Address) if err != nil { - return big.Int{}, fmt.Errorf("failed to get resolve size: %v", err) + return types.EmptyInt, fmt.Errorf("loading reward actor: %w", err) + } + if !found { + return types.EmptyInt, fmt.Errorf("reward actor not found") } - store := msa.ChainReader.Store(ctx) - var sectorWeight abi.StoragePower - if act, found, err := state.GetActor(ctx, market.Address); err != nil || !found { - return big.Int{}, fmt.Errorf("loading miner actor %s: %v", maddr, err) - } else if s, err := market.Load(store, act); err != nil { - return big.Int{}, fmt.Errorf("loading market actor state %s: %v", maddr, err) - } else if w, vw, err := s.VerifyDealsForActivation(maddr, pci.DealIDs, ts.Height(), pci.Expiration); err != nil { - return big.Int{}, fmt.Errorf("verifying deals for activation: %v", err) - } else { - // NB: not exactly accurate, but should always lead us to *over* estimate, not under - duration := pci.Expiration - ts.Height() - sectorWeight = builtin.QAPowerForWeight(ssize, duration, w, vw) + rewardState, err := reward.Load(msa.ChainReader.Store(ctx), rewardActor) + if err != nil { + return types.EmptyInt, fmt.Errorf("loading reward actor state: %w", err) } - var ( - powerSmoothed builtin.FilterEstimate - pledgeCollateral abi.TokenAmount + sectorWeight, err := msa.calculateSectorWeight(ctx, maddr, pci, ts.Height(), state) + if err != nil { + return types.EmptyInt, err + } + + pledgeCollateral, powerSmoothed, err := msa.pledgeCalculationInputs(ctx, state) + if err != nil { + return types.EmptyInt, err + } + + circSupply, err := msa.StateVMCirculatingSupplyInternal(ctx, ts.Key()) + if err != nil { + return types.EmptyInt, fmt.Errorf("getting circulating supply: %w", err) + } + + epochsSinceRampStart, rampDurationEpochs, err := msa.getPledgeRampParams(ctx, ts.Height(), state) + if err != nil { + return types.EmptyInt, fmt.Errorf("getting pledge ramp params: %w", err) + } + + initialPledge, err := rewardState.InitialPledgeForPower( + sectorWeight, + pledgeCollateral, + powerSmoothed, + circSupply.FilCirculating, + epochsSinceRampStart, + rampDurationEpochs, ) - if act, found, err := state.GetActor(ctx, power.Address); err != nil || !found { - return big.Int{}, fmt.Errorf("loading miner actor: %v", err) - } else if s, err := power.Load(store, act); err != nil { - return big.Int{}, fmt.Errorf("loading power actor state: %v", err) - } else if p, err := s.TotalPowerSmoothed(); err != nil { - return big.Int{}, fmt.Errorf("failed to determine total power: %v", err) - } else if c, err := s.TotalLocked(); err != nil { - return big.Int{}, fmt.Errorf("failed to determine pledge collateral: %v", err) - } else { - powerSmoothed = p - pledgeCollateral = c + if err != nil { + return types.EmptyInt, fmt.Errorf("calculating initial pledge: %w", err) + } + + return types.BigDiv(types.BigMul(initialPledge, initialPledgeNum), initialPledgeDen), nil +} + +// getPledgeRampParams returns epochsSinceRampStart, rampDurationEpochs, or 0, 0 if the pledge ramp is not active. +func (msa *minerStateAPI) getPledgeRampParams(ctx context.Context, height abi.ChainEpoch, state tree.Tree) (int64, uint64, error) { + if powerActor, found, err := state.GetActor(ctx, power.Address); err != nil { + return 0, 0, fmt.Errorf("loading power actor: %w", err) + } else if !found { + return 0, 0, fmt.Errorf("power actor not found") + } else if powerState, err := power.Load(msa.ChainReader.Store(ctx), powerActor); err != nil { + return 0, 0, fmt.Errorf("loading power actor state: %w", err) + } else if powerState.RampStartEpoch() > 0 { + return int64(height) - powerState.RampStartEpoch(), powerState.RampDurationEpochs(), nil + } + return 0, 0, nil +} + +func (msa *minerStateAPI) StateMinerInitialPledgeForSector(ctx context.Context, sectorDuration abi.ChainEpoch, sectorSize abi.SectorSize, verifiedSize uint64, tsk types.TipSetKey) (types.BigInt, error) { + if sectorDuration <= 0 { + return types.EmptyInt, fmt.Errorf("sector duration must greater than 0") + } + if sectorSize == 0 { + return types.EmptyInt, fmt.Errorf("sector size must be non-zero") + } + if verifiedSize > uint64(sectorSize) { + return types.EmptyInt, fmt.Errorf("verified size must be less than or equal to sector size") + } + + ts, err := msa.ChainReader.GetTipSet(ctx, tsk) + if err != nil { + return types.EmptyInt, fmt.Errorf("loading tipset %s: %w", tsk, err) + } + + _, state, err := msa.Stmgr.ParentState(ctx, ts) + if err != nil { + return big.Int{}, fmt.Errorf("loading tipset(%s) parent state failed: %v", tsk, err) } rewardActor, found, err := state.GetActor(ctx, reward.Address) - if err != nil || !found { - return big.Int{}, fmt.Errorf("loading miner actor: %v", err) + if err != nil { + return types.EmptyInt, fmt.Errorf("loading reward actor: %w", err) + } + if !found { + return types.EmptyInt, fmt.Errorf("reward actor not found") } - rewardState, err := reward.Load(store, rewardActor) + rewardState, err := reward.Load(msa.ChainReader.Store(ctx), rewardActor) if err != nil { - return big.Int{}, fmt.Errorf("loading reward actor state: %v", err) + return types.EmptyInt, fmt.Errorf("loading reward actor state: %w", err) } circSupply, err := msa.StateVMCirculatingSupplyInternal(ctx, ts.Key()) if err != nil { - return big.Zero(), fmt.Errorf("getting circulating supply: %v", err) + return types.EmptyInt, fmt.Errorf("getting circulating supply: %w", err) + } + + pledgeCollateral, powerSmoothed, err := msa.pledgeCalculationInputs(ctx, state) + if err != nil { + return types.EmptyInt, err + } + + verifiedWeight := big.Mul(big.NewIntUnsigned(verifiedSize), big.NewInt(int64(sectorDuration))) + sectorWeight := builtin.QAPowerForWeight(sectorSize, sectorDuration, big.Zero(), verifiedWeight) + + epochsSinceRampStart, rampDurationEpochs, err := msa.getPledgeRampParams(ctx, ts.Height(), state) + if err != nil { + return types.EmptyInt, fmt.Errorf("getting pledge ramp params: %w", err) } initialPledge, err := rewardState.InitialPledgeForPower( sectorWeight, pledgeCollateral, - &powerSmoothed, + powerSmoothed, circSupply.FilCirculating, + epochsSinceRampStart, + rampDurationEpochs, ) if err != nil { - return big.Zero(), fmt.Errorf("calculating initial pledge: %v", err) + return types.EmptyInt, fmt.Errorf("calculating initial pledge: %w", err) } - return big.Div(big.Mul(initialPledge, initialPledgeNum), initialPledgeDen), nil + return types.BigDiv(types.BigMul(initialPledge, initialPledgeNum), initialPledgeDen), nil } // StateVMCirculatingSupplyInternal returns an approximation of the circulating supply of Filecoin at the given tipset. @@ -910,7 +1005,7 @@ func (msa *minerStateAPI) StateMarketDeals(ctx context.Context, tsk types.TipSet } // StateMinerActiveSectors returns info about sectors that a given miner is actively proving. -func (msa *minerStateAPI) StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) { // TODO: only used in cli +func (msa *minerStateAPI) StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*miner.SectorOnChainInfo, error) { // TODO: only used in cli _, view, err := msa.Stmgr.ParentStateViewTsk(ctx, tsk) if err != nil { return nil, fmt.Errorf("Stmgr.ParentStateViewTsk failed:%v", err) @@ -1035,7 +1130,7 @@ func (msa *minerStateAPI) StateMinerAvailableBalance(ctx context.Context, maddr } // StateSectorExpiration returns epoch at which given sector will expire -func (msa *minerStateAPI) StateSectorExpiration(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorExpiration, error) { +func (msa *minerStateAPI) StateSectorExpiration(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorExpiration, error) { _, view, err := msa.Stmgr.ParentStateViewTsk(ctx, tsk) if err != nil { return nil, fmt.Errorf("Stmgr.ParentStateViewTsk failed:%v", err) @@ -1057,8 +1152,8 @@ func (msa *minerStateAPI) StateMinerSectorCount(ctx context.Context, addr addres } var activeCount, liveCount, faultyCount uint64 - if err := mas.ForEachDeadline(func(_ uint64, dl lminer.Deadline) error { - return dl.ForEachPartition(func(_ uint64, part lminer.Partition) error { + if err := mas.ForEachDeadline(func(_ uint64, dl miner.Deadline) error { + return dl.ForEachPartition(func(_ uint64, part miner.Partition) error { if active, err := part.ActiveSectors(); err != nil { return err } else if count, err := active.Count(); err != nil { @@ -1414,7 +1509,7 @@ func (msa *minerStateAPI) StateMinerAllocated(ctx context.Context, addr address. if err != nil { return nil, err } - mas, err := lminer.Load(msa.ChainReader.Store(ctx), act) + mas, err := miner.Load(msa.ChainReader.Store(ctx), act) if err != nil { return nil, err } diff --git a/venus-shared/api/chain/v0/chain.go b/venus-shared/api/chain/v0/chain.go index 5534e29406..fa515c0d67 100644 --- a/venus-shared/api/chain/v0/chain.go +++ b/venus-shared/api/chain/v0/chain.go @@ -155,22 +155,35 @@ type IMinerState interface { // StateGetClaim returns the claim for a given address and claim ID. StateGetClaim(ctx context.Context, providerAddr address.Address, claimID types.ClaimId, tsk types.TipSetKey) (*types.Claim, error) //perm:read // StateGetClaims returns the all the claims for a given provider. - StateGetClaims(ctx context.Context, providerAddr address.Address, tsk types.TipSetKey) (map[types.ClaimId]types.Claim, error) //perm:read - StateMinerPreCommitDepositForPower(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) //perm:read - StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) //perm:read - StateVMCirculatingSupplyInternal(ctx context.Context, tsk types.TipSetKey) (types.CirculatingSupply, error) //perm:read - StateCirculatingSupply(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error) //perm:read - StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]*types.MarketDeal, error) //perm:read - StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) //perm:read - StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) //perm:read - StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) //perm:read - StateListActors(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) //perm:read - StateMinerPower(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.MinerPower, error) //perm:read - StateMinerAvailableBalance(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (big.Int, error) //perm:read - StateSectorExpiration(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorExpiration, error) //perm:read - StateChangedActors(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) //perm:read - StateMinerSectorCount(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MinerSectors, error) //perm:read - StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MarketBalance, error) //perm:read - StateDealProviderCollateralBounds(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (types.DealCollateralBounds, error) //perm:read - StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error) //perm:read + StateGetClaims(ctx context.Context, providerAddr address.Address, tsk types.TipSetKey) (map[types.ClaimId]types.Claim, error) //perm:read + StateMinerPreCommitDepositForPower(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) //perm:read + // StateMinerInitialPledgeCollateral attempts to calculate the initial pledge collateral based on a SectorPreCommitInfo. + // This method uses the DealIDs field in SectorPreCommitInfo to determine the amount of verified + // deal space in the sector in order to perform a QAP calculation. Since network version 22 and + // the introduction of DDO, the DealIDs field can no longer be used to reliably determine verified + // deal space; therefore, this method is deprecated. Use StateMinerInitialPledgeForSector instead + // and pass in the verified deal space directly. + // + // Deprecated: Use StateMinerInitialPledgeForSector instead. + StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) //perm:read + // StateMinerInitialPledgeForSector returns the initial pledge collateral for a given sector + // duration, size, and combined size of any verified pieces within the sector. This calculation + // depends on current network conditions (total power, total pledge and current rewards) at the + // given tipset. + StateMinerInitialPledgeForSector(ctx context.Context, sectorDuration abi.ChainEpoch, sectorSize abi.SectorSize, verifiedSize uint64, tsk types.TipSetKey) (types.BigInt, error) //perm:read + StateVMCirculatingSupplyInternal(ctx context.Context, tsk types.TipSetKey) (types.CirculatingSupply, error) //perm:read + StateCirculatingSupply(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error) //perm:read + StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]*types.MarketDeal, error) //perm:read + StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) //perm:read + StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) //perm:read + StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) //perm:read + StateListActors(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) //perm:read + StateMinerPower(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.MinerPower, error) //perm:read + StateMinerAvailableBalance(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (big.Int, error) //perm:read + StateSectorExpiration(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorExpiration, error) //perm:read + StateChangedActors(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) //perm:read + StateMinerSectorCount(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MinerSectors, error) //perm:read + StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MarketBalance, error) //perm:read + StateDealProviderCollateralBounds(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (types.DealCollateralBounds, error) //perm:read + StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error) //perm:read } diff --git a/venus-shared/api/chain/v0/method.md b/venus-shared/api/chain/v0/method.md index f13cf39c80..75bd9fe55a 100644 --- a/venus-shared/api/chain/v0/method.md +++ b/venus-shared/api/chain/v0/method.md @@ -115,6 +115,7 @@ curl http://:/rpc/v0 -X POST -H "Content-Type: application/json" -H " * [StateMinerFaults](#stateminerfaults) * [StateMinerInfo](#stateminerinfo) * [StateMinerInitialPledgeCollateral](#stateminerinitialpledgecollateral) + * [StateMinerInitialPledgeForSector](#stateminerinitialpledgeforsector) * [StateMinerPartitions](#stateminerpartitions) * [StateMinerPower](#stateminerpower) * [StateMinerPreCommitDepositForPower](#stateminerprecommitdepositforpower) @@ -1222,7 +1223,7 @@ Perms: read Inputs: ```json [ - 23 + 24 ] ``` @@ -1237,7 +1238,7 @@ Perms: read Inputs: ```json [ - 23 + 24 ] ``` @@ -1662,7 +1663,8 @@ Response: "UpgradeWatermelonHeight": 10101, "UpgradeDragonHeight": 10101, "UpgradePhoenixHeight": 10101, - "UpgradeWaffleHeight": 10101 + "UpgradeWaffleHeight": 10101, + "UpgradeTuktukHeight": 10101 }, "Eip155ChainID": 123 } @@ -1780,7 +1782,7 @@ Inputs: ] ``` -Response: `23` +Response: `24` ### StateReplay @@ -3795,6 +3797,14 @@ Response: ``` ### StateMinerInitialPledgeCollateral +StateMinerInitialPledgeCollateral attempts to calculate the initial pledge collateral based on a SectorPreCommitInfo. +This method uses the DealIDs field in SectorPreCommitInfo to determine the amount of verified +deal space in the sector in order to perform a QAP calculation. Since network version 22 and +the introduction of DDO, the DealIDs field can no longer be used to reliably determine verified +deal space; therefore, this method is deprecated. Use StateMinerInitialPledgeForSector instead +and pass in the verified deal space directly. + +Deprecated: Use StateMinerInitialPledgeForSector instead. Perms: read @@ -3831,6 +3841,34 @@ Inputs: Response: `"0"` +### StateMinerInitialPledgeForSector +StateMinerInitialPledgeForSector returns the initial pledge collateral for a given sector +duration, size, and combined size of any verified pieces within the sector. This calculation +depends on current network conditions (total power, total pledge and current rewards) at the +given tipset. + + +Perms: read + +Inputs: +```json +[ + 10101, + 34359738368, + 42, + [ + { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + { + "/": "bafy2bzacebp3shtrn43k7g3unredz7fxn4gj533d3o43tqn2p2ipxxhrvchve" + } + ] +] +``` + +Response: `"0"` + ### StateMinerPartitions diff --git a/venus-shared/api/chain/v0/mock/mock_fullnode.go b/venus-shared/api/chain/v0/mock/mock_fullnode.go index 64a43707a2..9d6b3c8f5d 100644 --- a/venus-shared/api/chain/v0/mock/mock_fullnode.go +++ b/venus-shared/api/chain/v0/mock/mock_fullnode.go @@ -2044,6 +2044,21 @@ func (mr *MockFullNodeMockRecorder) StateMinerInitialPledgeCollateral(arg0, arg1 return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMinerInitialPledgeCollateral", reflect.TypeOf((*MockFullNode)(nil).StateMinerInitialPledgeCollateral), arg0, arg1, arg2, arg3) } +// StateMinerInitialPledgeForSector mocks base method. +func (m *MockFullNode) StateMinerInitialPledgeForSector(arg0 context.Context, arg1 abi.ChainEpoch, arg2 abi.SectorSize, arg3 uint64, arg4 types0.TipSetKey) (big.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StateMinerInitialPledgeForSector", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(big.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StateMinerInitialPledgeForSector indicates an expected call of StateMinerInitialPledgeForSector. +func (mr *MockFullNodeMockRecorder) StateMinerInitialPledgeForSector(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMinerInitialPledgeForSector", reflect.TypeOf((*MockFullNode)(nil).StateMinerInitialPledgeForSector), arg0, arg1, arg2, arg3, arg4) +} + // StateMinerPartitions mocks base method. func (m *MockFullNode) StateMinerPartitions(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 types0.TipSetKey) ([]types0.Partition, error) { m.ctrl.T.Helper() diff --git a/venus-shared/api/chain/v0/proxy_gen.go b/venus-shared/api/chain/v0/proxy_gen.go index 06b939b6fb..80c63ef76e 100644 --- a/venus-shared/api/chain/v0/proxy_gen.go +++ b/venus-shared/api/chain/v0/proxy_gen.go @@ -85,46 +85,47 @@ func (s *IBeaconStruct) BeaconGetEntry(p0 context.Context, p1 abi.ChainEpoch) (* type IMinerStateStruct struct { Internal struct { - StateAllMinerFaults func(ctx context.Context, lookback abi.ChainEpoch, ts types.TipSetKey) ([]*types.Fault, error) `perm:"read"` - StateChangedActors func(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) `perm:"read"` - StateCirculatingSupply func(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error) `perm:"read"` - StateDealProviderCollateralBounds func(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (types.DealCollateralBounds, error) `perm:"read"` - StateDecodeParams func(ctx context.Context, toAddr address.Address, method abi.MethodNum, params []byte, tsk types.TipSetKey) (interface{}, error) `perm:"read"` - StateGetAllocation func(ctx context.Context, clientAddr address.Address, allocationID types.AllocationId, tsk types.TipSetKey) (*types.Allocation, error) `perm:"read"` - StateGetAllocationForPendingDeal func(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*types.Allocation, error) `perm:"read"` - StateGetAllocations func(ctx context.Context, clientAddr address.Address, tsk types.TipSetKey) (map[types.AllocationId]types.Allocation, error) `perm:"read"` - StateGetClaim func(ctx context.Context, providerAddr address.Address, claimID types.ClaimId, tsk types.TipSetKey) (*types.Claim, error) `perm:"read"` - StateGetClaims func(ctx context.Context, providerAddr address.Address, tsk types.TipSetKey) (map[types.ClaimId]types.Claim, error) `perm:"read"` - StateListActors func(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) `perm:"read"` - StateListMessages func(ctx context.Context, match *types.MessageMatch, tsk types.TipSetKey, toht abi.ChainEpoch) ([]cid.Cid, error) `perm:"read"` - StateListMiners func(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) `perm:"read"` - StateLookupID func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) `perm:"read"` - StateMarketBalance func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MarketBalance, error) `perm:"read"` - StateMarketDeals func(ctx context.Context, tsk types.TipSetKey) (map[string]*types.MarketDeal, error) `perm:"read"` - StateMarketStorageDeal func(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*types.MarketDeal, error) `perm:"read"` - StateMinerActiveSectors func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) `perm:"read"` - StateMinerAvailableBalance func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (big.Int, error) `perm:"read"` - StateMinerDeadlines func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]types.Deadline, error) `perm:"read"` - StateMinerFaults func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (bitfield.BitField, error) `perm:"read"` - StateMinerInfo func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (types.MinerInfo, error) `perm:"read"` - StateMinerInitialPledgeCollateral func(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) `perm:"read"` - StateMinerPartitions func(ctx context.Context, maddr address.Address, dlIdx uint64, tsk types.TipSetKey) ([]types.Partition, error) `perm:"read"` - StateMinerPower func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.MinerPower, error) `perm:"read"` - StateMinerPreCommitDepositForPower func(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) `perm:"read"` - StateMinerProvingDeadline func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (*dline.Info, error) `perm:"read"` - StateMinerRecoveries func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (bitfield.BitField, error) `perm:"read"` - StateMinerSectorAllocated func(ctx context.Context, maddr address.Address, s abi.SectorNumber, tsk types.TipSetKey) (bool, error) `perm:"read"` - StateMinerSectorCount func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MinerSectors, error) `perm:"read"` - StateMinerSectorSize func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (abi.SectorSize, error) `perm:"read"` - StateMinerSectors func(ctx context.Context, maddr address.Address, sectorNos *bitfield.BitField, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) `perm:"read"` - StateMinerWorkerAddress func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (address.Address, error) `perm:"read"` - StateReadState func(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.ActorState, error) `perm:"read"` - StateSectorExpiration func(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorExpiration, error) `perm:"read"` - StateSectorGetInfo func(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorOnChainInfo, error) `perm:"read"` - StateSectorPartition func(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorLocation, error) `perm:"read"` - StateSectorPreCommitInfo func(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (types.SectorPreCommitOnChainInfo, error) `perm:"read"` - StateVMCirculatingSupplyInternal func(ctx context.Context, tsk types.TipSetKey) (types.CirculatingSupply, error) `perm:"read"` - StateVerifiedClientStatus func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error) `perm:"read"` + StateAllMinerFaults func(ctx context.Context, lookback abi.ChainEpoch, ts types.TipSetKey) ([]*types.Fault, error) `perm:"read"` + StateChangedActors func(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) `perm:"read"` + StateCirculatingSupply func(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error) `perm:"read"` + StateDealProviderCollateralBounds func(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (types.DealCollateralBounds, error) `perm:"read"` + StateDecodeParams func(ctx context.Context, toAddr address.Address, method abi.MethodNum, params []byte, tsk types.TipSetKey) (interface{}, error) `perm:"read"` + StateGetAllocation func(ctx context.Context, clientAddr address.Address, allocationID types.AllocationId, tsk types.TipSetKey) (*types.Allocation, error) `perm:"read"` + StateGetAllocationForPendingDeal func(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*types.Allocation, error) `perm:"read"` + StateGetAllocations func(ctx context.Context, clientAddr address.Address, tsk types.TipSetKey) (map[types.AllocationId]types.Allocation, error) `perm:"read"` + StateGetClaim func(ctx context.Context, providerAddr address.Address, claimID types.ClaimId, tsk types.TipSetKey) (*types.Claim, error) `perm:"read"` + StateGetClaims func(ctx context.Context, providerAddr address.Address, tsk types.TipSetKey) (map[types.ClaimId]types.Claim, error) `perm:"read"` + StateListActors func(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) `perm:"read"` + StateListMessages func(ctx context.Context, match *types.MessageMatch, tsk types.TipSetKey, toht abi.ChainEpoch) ([]cid.Cid, error) `perm:"read"` + StateListMiners func(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) `perm:"read"` + StateLookupID func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) `perm:"read"` + StateMarketBalance func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MarketBalance, error) `perm:"read"` + StateMarketDeals func(ctx context.Context, tsk types.TipSetKey) (map[string]*types.MarketDeal, error) `perm:"read"` + StateMarketStorageDeal func(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*types.MarketDeal, error) `perm:"read"` + StateMinerActiveSectors func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) `perm:"read"` + StateMinerAvailableBalance func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (big.Int, error) `perm:"read"` + StateMinerDeadlines func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]types.Deadline, error) `perm:"read"` + StateMinerFaults func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (bitfield.BitField, error) `perm:"read"` + StateMinerInfo func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (types.MinerInfo, error) `perm:"read"` + StateMinerInitialPledgeCollateral func(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) `perm:"read"` + StateMinerInitialPledgeForSector func(ctx context.Context, sectorDuration abi.ChainEpoch, sectorSize abi.SectorSize, verifiedSize uint64, tsk types.TipSetKey) (types.BigInt, error) `perm:"read"` + StateMinerPartitions func(ctx context.Context, maddr address.Address, dlIdx uint64, tsk types.TipSetKey) ([]types.Partition, error) `perm:"read"` + StateMinerPower func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.MinerPower, error) `perm:"read"` + StateMinerPreCommitDepositForPower func(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) `perm:"read"` + StateMinerProvingDeadline func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (*dline.Info, error) `perm:"read"` + StateMinerRecoveries func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (bitfield.BitField, error) `perm:"read"` + StateMinerSectorAllocated func(ctx context.Context, maddr address.Address, s abi.SectorNumber, tsk types.TipSetKey) (bool, error) `perm:"read"` + StateMinerSectorCount func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MinerSectors, error) `perm:"read"` + StateMinerSectorSize func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (abi.SectorSize, error) `perm:"read"` + StateMinerSectors func(ctx context.Context, maddr address.Address, sectorNos *bitfield.BitField, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) `perm:"read"` + StateMinerWorkerAddress func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (address.Address, error) `perm:"read"` + StateReadState func(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.ActorState, error) `perm:"read"` + StateSectorExpiration func(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorExpiration, error) `perm:"read"` + StateSectorGetInfo func(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorOnChainInfo, error) `perm:"read"` + StateSectorPartition func(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorLocation, error) `perm:"read"` + StateSectorPreCommitInfo func(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (types.SectorPreCommitOnChainInfo, error) `perm:"read"` + StateVMCirculatingSupplyInternal func(ctx context.Context, tsk types.TipSetKey) (types.CirculatingSupply, error) `perm:"read"` + StateVerifiedClientStatus func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error) `perm:"read"` } } @@ -197,6 +198,9 @@ func (s *IMinerStateStruct) StateMinerInfo(p0 context.Context, p1 address.Addres func (s *IMinerStateStruct) StateMinerInitialPledgeCollateral(p0 context.Context, p1 address.Address, p2 types.SectorPreCommitInfo, p3 types.TipSetKey) (big.Int, error) { return s.Internal.StateMinerInitialPledgeCollateral(p0, p1, p2, p3) } +func (s *IMinerStateStruct) StateMinerInitialPledgeForSector(p0 context.Context, p1 abi.ChainEpoch, p2 abi.SectorSize, p3 uint64, p4 types.TipSetKey) (types.BigInt, error) { + return s.Internal.StateMinerInitialPledgeForSector(p0, p1, p2, p3, p4) +} func (s *IMinerStateStruct) StateMinerPartitions(p0 context.Context, p1 address.Address, p2 uint64, p3 types.TipSetKey) ([]types.Partition, error) { return s.Internal.StateMinerPartitions(p0, p1, p2, p3) } diff --git a/venus-shared/api/chain/v1/chain.go b/venus-shared/api/chain/v1/chain.go index f2b4907218..ec21c2f7ca 100644 --- a/venus-shared/api/chain/v1/chain.go +++ b/venus-shared/api/chain/v1/chain.go @@ -185,30 +185,43 @@ type IMinerState interface { StateMarketStorageDeal(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*types.MarketDeal, error) //perm:read // StateGetAllocationForPendingDeal returns the allocation for a given deal ID of a pending deal. Returns nil if // pending allocation is not found. - StateGetAllocationForPendingDeal(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*types.Allocation, error) //perm:read + StateGetAllocationForPendingDeal(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*verifreg.Allocation, error) //perm:read // StateGetAllocationIdForPendingDeal is like StateGetAllocationForPendingDeal except it returns the allocation ID StateGetAllocationIdForPendingDeal(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (verifreg.AllocationId, error) //perm:read // StateGetAllocation returns the allocation for a given address and allocation ID. - StateGetAllocation(ctx context.Context, clientAddr address.Address, allocationID types.AllocationId, tsk types.TipSetKey) (*types.Allocation, error) //perm:read + StateGetAllocation(ctx context.Context, clientAddr address.Address, allocationID verifreg.AllocationId, tsk types.TipSetKey) (*verifreg.Allocation, error) //perm:read // StateGetAllAllocations returns the all the allocations available in verified registry actor. - StateGetAllAllocations(ctx context.Context, tsk types.TipSetKey) (map[types.AllocationId]types.Allocation, error) //perm:read + StateGetAllAllocations(ctx context.Context, tsk types.TipSetKey) (map[verifreg.AllocationId]verifreg.Allocation, error) //perm:read // StateGetAllocations returns the all the allocations for a given client. - StateGetAllocations(ctx context.Context, clientAddr address.Address, tsk types.TipSetKey) (map[types.AllocationId]types.Allocation, error) //perm:read + StateGetAllocations(ctx context.Context, clientAddr address.Address, tsk types.TipSetKey) (map[verifreg.AllocationId]verifreg.Allocation, error) //perm:read // StateGetClaim returns the claim for a given address and claim ID. - StateGetClaim(ctx context.Context, providerAddr address.Address, claimID types.ClaimId, tsk types.TipSetKey) (*types.Claim, error) //perm:read + StateGetClaim(ctx context.Context, providerAddr address.Address, claimID verifreg.ClaimId, tsk types.TipSetKey) (*verifreg.Claim, error) //perm:read // StateGetClaims returns the all the claims for a given provider. - StateGetClaims(ctx context.Context, providerAddr address.Address, tsk types.TipSetKey) (map[types.ClaimId]types.Claim, error) //perm:read + StateGetClaims(ctx context.Context, providerAddr address.Address, tsk types.TipSetKey) (map[verifreg.ClaimId]verifreg.Claim, error) //perm:read // StateGetAllClaims returns the all the claims available in verified registry actor. - StateGetAllClaims(ctx context.Context, tsk types.TipSetKey) (map[types.ClaimId]types.Claim, error) //perm:read + StateGetAllClaims(ctx context.Context, tsk types.TipSetKey) (map[verifreg.ClaimId]verifreg.Claim, error) //perm:read // StateComputeDataCID computes DataCID from a set of on-chain deals StateComputeDataCID(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error) //perm:read StateMinerPreCommitDepositForPower(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) //perm:read - StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) //perm:read - StateVMCirculatingSupplyInternal(ctx context.Context, tsk types.TipSetKey) (types.CirculatingSupply, error) //perm:read - StateCirculatingSupply(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error) //perm:read - StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]*types.MarketDeal, error) //perm:read - StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) //perm:read - StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) //perm:read + // StateMinerInitialPledgeCollateral attempts to calculate the initial pledge collateral based on a SectorPreCommitInfo. + // This method uses the DealIDs field in SectorPreCommitInfo to determine the amount of verified + // deal space in the sector in order to perform a QAP calculation. Since network version 22 and + // the introduction of DDO, the DealIDs field can no longer be used to reliably determine verified + // deal space; therefore, this method is deprecated. Use StateMinerInitialPledgeForSector instead + // and pass in the verified deal space directly. + // + // Deprecated: Use StateMinerInitialPledgeForSector instead. + StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) //perm:read + // StateMinerInitialPledgeForSector returns the initial pledge collateral for a given sector + // duration, size, and combined size of any verified pieces within the sector. This calculation + // depends on current network conditions (total power, total pledge and current rewards) at the + // given tipset. + StateMinerInitialPledgeForSector(ctx context.Context, sectorDuration abi.ChainEpoch, sectorSize abi.SectorSize, verifiedSize uint64, tsk types.TipSetKey) (types.BigInt, error) //perm:read + StateVMCirculatingSupplyInternal(ctx context.Context, tsk types.TipSetKey) (types.CirculatingSupply, error) //perm:read + StateCirculatingSupply(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error) //perm:read + StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]*types.MarketDeal, error) //perm:read + StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) //perm:read + StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) //perm:read // StateLookupRobustAddress returns the public key address of the given ID address for non-account addresses (multisig, miners etc) StateLookupRobustAddress(context.Context, address.Address, types.TipSetKey) (address.Address, error) //perm:read StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) //perm:read diff --git a/venus-shared/api/chain/v1/method.md b/venus-shared/api/chain/v1/method.md index ca6500187d..4af1712d89 100644 --- a/venus-shared/api/chain/v1/method.md +++ b/venus-shared/api/chain/v1/method.md @@ -183,6 +183,7 @@ curl http://:/rpc/v1 -X POST -H "Content-Type: application/json" -H " * [StateMinerFaults](#stateminerfaults) * [StateMinerInfo](#stateminerinfo) * [StateMinerInitialPledgeCollateral](#stateminerinitialpledgecollateral) + * [StateMinerInitialPledgeForSector](#stateminerinitialpledgeforsector) * [StateMinerPartitions](#stateminerpartitions) * [StateMinerPower](#stateminerpower) * [StateMinerPreCommitDepositForPower](#stateminerprecommitdepositforpower) @@ -1409,7 +1410,7 @@ Perms: read Inputs: ```json [ - 23 + 24 ] ``` @@ -1424,7 +1425,7 @@ Perms: read Inputs: ```json [ - 23 + 24 ] ``` @@ -1872,7 +1873,8 @@ Response: "UpgradeWatermelonHeight": 10101, "UpgradeDragonHeight": 10101, "UpgradePhoenixHeight": 10101, - "UpgradeWaffleHeight": 10101 + "UpgradeWaffleHeight": 10101, + "UpgradeTuktukHeight": 10101 }, "Eip155ChainID": 123 } @@ -2000,7 +2002,7 @@ Inputs: ] ``` -Response: `23` +Response: `24` ### StateReplay @@ -5586,6 +5588,14 @@ Response: ``` ### StateMinerInitialPledgeCollateral +StateMinerInitialPledgeCollateral attempts to calculate the initial pledge collateral based on a SectorPreCommitInfo. +This method uses the DealIDs field in SectorPreCommitInfo to determine the amount of verified +deal space in the sector in order to perform a QAP calculation. Since network version 22 and +the introduction of DDO, the DealIDs field can no longer be used to reliably determine verified +deal space; therefore, this method is deprecated. Use StateMinerInitialPledgeForSector instead +and pass in the verified deal space directly. + +Deprecated: Use StateMinerInitialPledgeForSector instead. Perms: read @@ -5622,6 +5632,34 @@ Inputs: Response: `"0"` +### StateMinerInitialPledgeForSector +StateMinerInitialPledgeForSector returns the initial pledge collateral for a given sector +duration, size, and combined size of any verified pieces within the sector. This calculation +depends on current network conditions (total power, total pledge and current rewards) at the +given tipset. + + +Perms: read + +Inputs: +```json +[ + 10101, + 34359738368, + 42, + [ + { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + { + "/": "bafy2bzacebp3shtrn43k7g3unredz7fxn4gj533d3o43tqn2p2ipxxhrvchve" + } + ] +] +``` + +Response: `"0"` + ### StateMinerPartitions diff --git a/venus-shared/api/chain/v1/mock/mock_fullnode.go b/venus-shared/api/chain/v1/mock/mock_fullnode.go index 7dc3d3a0c6..4461c949a7 100644 --- a/venus-shared/api/chain/v1/mock/mock_fullnode.go +++ b/venus-shared/api/chain/v1/mock/mock_fullnode.go @@ -3039,6 +3039,21 @@ func (mr *MockFullNodeMockRecorder) StateMinerInitialPledgeCollateral(arg0, arg1 return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMinerInitialPledgeCollateral", reflect.TypeOf((*MockFullNode)(nil).StateMinerInitialPledgeCollateral), arg0, arg1, arg2, arg3) } +// StateMinerInitialPledgeForSector mocks base method. +func (m *MockFullNode) StateMinerInitialPledgeForSector(arg0 context.Context, arg1 abi.ChainEpoch, arg2 abi.SectorSize, arg3 uint64, arg4 types0.TipSetKey) (big.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StateMinerInitialPledgeForSector", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(big.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StateMinerInitialPledgeForSector indicates an expected call of StateMinerInitialPledgeForSector. +func (mr *MockFullNodeMockRecorder) StateMinerInitialPledgeForSector(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMinerInitialPledgeForSector", reflect.TypeOf((*MockFullNode)(nil).StateMinerInitialPledgeForSector), arg0, arg1, arg2, arg3, arg4) +} + // StateMinerPartitions mocks base method. func (m *MockFullNode) StateMinerPartitions(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 types0.TipSetKey) ([]types0.Partition, error) { m.ctrl.T.Helper() diff --git a/venus-shared/api/chain/v1/proxy_gen.go b/venus-shared/api/chain/v1/proxy_gen.go index c017362867..abb7cef208 100644 --- a/venus-shared/api/chain/v1/proxy_gen.go +++ b/venus-shared/api/chain/v1/proxy_gen.go @@ -81,53 +81,54 @@ func (s *IActorStruct) StateGetActor(p0 context.Context, p1 address.Address, p2 type IMinerStateStruct struct { Internal struct { - StateAllMinerFaults func(ctx context.Context, lookback abi.ChainEpoch, ts types.TipSetKey) ([]*types.Fault, error) `perm:"read"` - StateChangedActors func(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) `perm:"read"` - StateCirculatingSupply func(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error) `perm:"read"` - StateComputeDataCID func(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error) `perm:"read"` - StateDealProviderCollateralBounds func(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (types.DealCollateralBounds, error) `perm:"read"` - StateDecodeParams func(ctx context.Context, toAddr address.Address, method abi.MethodNum, params []byte, tsk types.TipSetKey) (interface{}, error) `perm:"read"` - StateEncodeParams func(ctx context.Context, toActCode cid.Cid, method abi.MethodNum, params json.RawMessage) ([]byte, error) `perm:"read"` - StateGetAllAllocations func(ctx context.Context, tsk types.TipSetKey) (map[types.AllocationId]types.Allocation, error) `perm:"read"` - StateGetAllClaims func(ctx context.Context, tsk types.TipSetKey) (map[types.ClaimId]types.Claim, error) `perm:"read"` - StateGetAllocation func(ctx context.Context, clientAddr address.Address, allocationID types.AllocationId, tsk types.TipSetKey) (*types.Allocation, error) `perm:"read"` - StateGetAllocationForPendingDeal func(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*types.Allocation, error) `perm:"read"` - StateGetAllocationIdForPendingDeal func(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (verifreg.AllocationId, error) `perm:"read"` - StateGetAllocations func(ctx context.Context, clientAddr address.Address, tsk types.TipSetKey) (map[types.AllocationId]types.Allocation, error) `perm:"read"` - StateGetClaim func(ctx context.Context, providerAddr address.Address, claimID types.ClaimId, tsk types.TipSetKey) (*types.Claim, error) `perm:"read"` - StateGetClaims func(ctx context.Context, providerAddr address.Address, tsk types.TipSetKey) (map[types.ClaimId]types.Claim, error) `perm:"read"` - StateListActors func(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) `perm:"read"` - StateListMessages func(ctx context.Context, match *types.MessageMatch, tsk types.TipSetKey, toht abi.ChainEpoch) ([]cid.Cid, error) `perm:"read"` - StateListMiners func(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) `perm:"read"` - StateLookupID func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) `perm:"read"` - StateLookupRobustAddress func(context.Context, address.Address, types.TipSetKey) (address.Address, error) `perm:"read"` - StateMarketBalance func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MarketBalance, error) `perm:"read"` - StateMarketDeals func(ctx context.Context, tsk types.TipSetKey) (map[string]*types.MarketDeal, error) `perm:"read"` - StateMarketStorageDeal func(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*types.MarketDeal, error) `perm:"read"` - StateMinerActiveSectors func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) `perm:"read"` - StateMinerAllocated func(context.Context, address.Address, types.TipSetKey) (*bitfield.BitField, error) `perm:"read"` - StateMinerAvailableBalance func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (big.Int, error) `perm:"read"` - StateMinerDeadlines func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]types.Deadline, error) `perm:"read"` - StateMinerFaults func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (bitfield.BitField, error) `perm:"read"` - StateMinerInfo func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (types.MinerInfo, error) `perm:"read"` - StateMinerInitialPledgeCollateral func(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) `perm:"read"` - StateMinerPartitions func(ctx context.Context, maddr address.Address, dlIdx uint64, tsk types.TipSetKey) ([]types.Partition, error) `perm:"read"` - StateMinerPower func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.MinerPower, error) `perm:"read"` - StateMinerPreCommitDepositForPower func(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) `perm:"read"` - StateMinerProvingDeadline func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (*dline.Info, error) `perm:"read"` - StateMinerRecoveries func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (bitfield.BitField, error) `perm:"read"` - StateMinerSectorAllocated func(ctx context.Context, maddr address.Address, s abi.SectorNumber, tsk types.TipSetKey) (bool, error) `perm:"read"` - StateMinerSectorCount func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MinerSectors, error) `perm:"read"` - StateMinerSectorSize func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (abi.SectorSize, error) `perm:"read"` - StateMinerSectors func(ctx context.Context, maddr address.Address, sectorNos *bitfield.BitField, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) `perm:"read"` - StateMinerWorkerAddress func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (address.Address, error) `perm:"read"` - StateReadState func(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.ActorState, error) `perm:"read"` - StateSectorExpiration func(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorExpiration, error) `perm:"read"` - StateSectorGetInfo func(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorOnChainInfo, error) `perm:"read"` - StateSectorPartition func(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorLocation, error) `perm:"read"` - StateSectorPreCommitInfo func(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*types.SectorPreCommitOnChainInfo, error) `perm:"read"` - StateVMCirculatingSupplyInternal func(ctx context.Context, tsk types.TipSetKey) (types.CirculatingSupply, error) `perm:"read"` - StateVerifiedClientStatus func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error) `perm:"read"` + StateAllMinerFaults func(ctx context.Context, lookback abi.ChainEpoch, ts types.TipSetKey) ([]*types.Fault, error) `perm:"read"` + StateChangedActors func(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) `perm:"read"` + StateCirculatingSupply func(ctx context.Context, tsk types.TipSetKey) (abi.TokenAmount, error) `perm:"read"` + StateComputeDataCID func(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error) `perm:"read"` + StateDealProviderCollateralBounds func(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (types.DealCollateralBounds, error) `perm:"read"` + StateDecodeParams func(ctx context.Context, toAddr address.Address, method abi.MethodNum, params []byte, tsk types.TipSetKey) (interface{}, error) `perm:"read"` + StateEncodeParams func(ctx context.Context, toActCode cid.Cid, method abi.MethodNum, params json.RawMessage) ([]byte, error) `perm:"read"` + StateGetAllAllocations func(ctx context.Context, tsk types.TipSetKey) (map[verifreg.AllocationId]verifreg.Allocation, error) `perm:"read"` + StateGetAllClaims func(ctx context.Context, tsk types.TipSetKey) (map[verifreg.ClaimId]verifreg.Claim, error) `perm:"read"` + StateGetAllocation func(ctx context.Context, clientAddr address.Address, allocationID verifreg.AllocationId, tsk types.TipSetKey) (*verifreg.Allocation, error) `perm:"read"` + StateGetAllocationForPendingDeal func(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*verifreg.Allocation, error) `perm:"read"` + StateGetAllocationIdForPendingDeal func(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (verifreg.AllocationId, error) `perm:"read"` + StateGetAllocations func(ctx context.Context, clientAddr address.Address, tsk types.TipSetKey) (map[verifreg.AllocationId]verifreg.Allocation, error) `perm:"read"` + StateGetClaim func(ctx context.Context, providerAddr address.Address, claimID verifreg.ClaimId, tsk types.TipSetKey) (*verifreg.Claim, error) `perm:"read"` + StateGetClaims func(ctx context.Context, providerAddr address.Address, tsk types.TipSetKey) (map[verifreg.ClaimId]verifreg.Claim, error) `perm:"read"` + StateListActors func(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) `perm:"read"` + StateListMessages func(ctx context.Context, match *types.MessageMatch, tsk types.TipSetKey, toht abi.ChainEpoch) ([]cid.Cid, error) `perm:"read"` + StateListMiners func(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) `perm:"read"` + StateLookupID func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) `perm:"read"` + StateLookupRobustAddress func(context.Context, address.Address, types.TipSetKey) (address.Address, error) `perm:"read"` + StateMarketBalance func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MarketBalance, error) `perm:"read"` + StateMarketDeals func(ctx context.Context, tsk types.TipSetKey) (map[string]*types.MarketDeal, error) `perm:"read"` + StateMarketStorageDeal func(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*types.MarketDeal, error) `perm:"read"` + StateMinerActiveSectors func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) `perm:"read"` + StateMinerAllocated func(context.Context, address.Address, types.TipSetKey) (*bitfield.BitField, error) `perm:"read"` + StateMinerAvailableBalance func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (big.Int, error) `perm:"read"` + StateMinerDeadlines func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]types.Deadline, error) `perm:"read"` + StateMinerFaults func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (bitfield.BitField, error) `perm:"read"` + StateMinerInfo func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (types.MinerInfo, error) `perm:"read"` + StateMinerInitialPledgeCollateral func(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) `perm:"read"` + StateMinerInitialPledgeForSector func(ctx context.Context, sectorDuration abi.ChainEpoch, sectorSize abi.SectorSize, verifiedSize uint64, tsk types.TipSetKey) (types.BigInt, error) `perm:"read"` + StateMinerPartitions func(ctx context.Context, maddr address.Address, dlIdx uint64, tsk types.TipSetKey) ([]types.Partition, error) `perm:"read"` + StateMinerPower func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.MinerPower, error) `perm:"read"` + StateMinerPreCommitDepositForPower func(ctx context.Context, maddr address.Address, pci types.SectorPreCommitInfo, tsk types.TipSetKey) (big.Int, error) `perm:"read"` + StateMinerProvingDeadline func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (*dline.Info, error) `perm:"read"` + StateMinerRecoveries func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (bitfield.BitField, error) `perm:"read"` + StateMinerSectorAllocated func(ctx context.Context, maddr address.Address, s abi.SectorNumber, tsk types.TipSetKey) (bool, error) `perm:"read"` + StateMinerSectorCount func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.MinerSectors, error) `perm:"read"` + StateMinerSectorSize func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (abi.SectorSize, error) `perm:"read"` + StateMinerSectors func(ctx context.Context, maddr address.Address, sectorNos *bitfield.BitField, tsk types.TipSetKey) ([]*lminer.SectorOnChainInfo, error) `perm:"read"` + StateMinerWorkerAddress func(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (address.Address, error) `perm:"read"` + StateReadState func(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.ActorState, error) `perm:"read"` + StateSectorExpiration func(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorExpiration, error) `perm:"read"` + StateSectorGetInfo func(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorOnChainInfo, error) `perm:"read"` + StateSectorPartition func(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorLocation, error) `perm:"read"` + StateSectorPreCommitInfo func(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*types.SectorPreCommitOnChainInfo, error) `perm:"read"` + StateVMCirculatingSupplyInternal func(ctx context.Context, tsk types.TipSetKey) (types.CirculatingSupply, error) `perm:"read"` + StateVerifiedClientStatus func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error) `perm:"read"` } } @@ -152,28 +153,28 @@ func (s *IMinerStateStruct) StateDecodeParams(p0 context.Context, p1 address.Add func (s *IMinerStateStruct) StateEncodeParams(p0 context.Context, p1 cid.Cid, p2 abi.MethodNum, p3 json.RawMessage) ([]byte, error) { return s.Internal.StateEncodeParams(p0, p1, p2, p3) } -func (s *IMinerStateStruct) StateGetAllAllocations(p0 context.Context, p1 types.TipSetKey) (map[types.AllocationId]types.Allocation, error) { +func (s *IMinerStateStruct) StateGetAllAllocations(p0 context.Context, p1 types.TipSetKey) (map[verifreg.AllocationId]verifreg.Allocation, error) { return s.Internal.StateGetAllAllocations(p0, p1) } -func (s *IMinerStateStruct) StateGetAllClaims(p0 context.Context, p1 types.TipSetKey) (map[types.ClaimId]types.Claim, error) { +func (s *IMinerStateStruct) StateGetAllClaims(p0 context.Context, p1 types.TipSetKey) (map[verifreg.ClaimId]verifreg.Claim, error) { return s.Internal.StateGetAllClaims(p0, p1) } -func (s *IMinerStateStruct) StateGetAllocation(p0 context.Context, p1 address.Address, p2 types.AllocationId, p3 types.TipSetKey) (*types.Allocation, error) { +func (s *IMinerStateStruct) StateGetAllocation(p0 context.Context, p1 address.Address, p2 verifreg.AllocationId, p3 types.TipSetKey) (*verifreg.Allocation, error) { return s.Internal.StateGetAllocation(p0, p1, p2, p3) } -func (s *IMinerStateStruct) StateGetAllocationForPendingDeal(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*types.Allocation, error) { +func (s *IMinerStateStruct) StateGetAllocationForPendingDeal(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*verifreg.Allocation, error) { return s.Internal.StateGetAllocationForPendingDeal(p0, p1, p2) } func (s *IMinerStateStruct) StateGetAllocationIdForPendingDeal(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (verifreg.AllocationId, error) { return s.Internal.StateGetAllocationIdForPendingDeal(p0, p1, p2) } -func (s *IMinerStateStruct) StateGetAllocations(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[types.AllocationId]types.Allocation, error) { +func (s *IMinerStateStruct) StateGetAllocations(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifreg.AllocationId]verifreg.Allocation, error) { return s.Internal.StateGetAllocations(p0, p1, p2) } -func (s *IMinerStateStruct) StateGetClaim(p0 context.Context, p1 address.Address, p2 types.ClaimId, p3 types.TipSetKey) (*types.Claim, error) { +func (s *IMinerStateStruct) StateGetClaim(p0 context.Context, p1 address.Address, p2 verifreg.ClaimId, p3 types.TipSetKey) (*verifreg.Claim, error) { return s.Internal.StateGetClaim(p0, p1, p2, p3) } -func (s *IMinerStateStruct) StateGetClaims(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[types.ClaimId]types.Claim, error) { +func (s *IMinerStateStruct) StateGetClaims(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (map[verifreg.ClaimId]verifreg.Claim, error) { return s.Internal.StateGetClaims(p0, p1, p2) } func (s *IMinerStateStruct) StateListActors(p0 context.Context, p1 types.TipSetKey) ([]address.Address, error) { @@ -221,6 +222,9 @@ func (s *IMinerStateStruct) StateMinerInfo(p0 context.Context, p1 address.Addres func (s *IMinerStateStruct) StateMinerInitialPledgeCollateral(p0 context.Context, p1 address.Address, p2 types.SectorPreCommitInfo, p3 types.TipSetKey) (big.Int, error) { return s.Internal.StateMinerInitialPledgeCollateral(p0, p1, p2, p3) } +func (s *IMinerStateStruct) StateMinerInitialPledgeForSector(p0 context.Context, p1 abi.ChainEpoch, p2 abi.SectorSize, p3 uint64, p4 types.TipSetKey) (types.BigInt, error) { + return s.Internal.StateMinerInitialPledgeForSector(p0, p1, p2, p3, p4) +} func (s *IMinerStateStruct) StateMinerPartitions(p0 context.Context, p1 address.Address, p2 uint64, p3 types.TipSetKey) ([]types.Partition, error) { return s.Internal.StateMinerPartitions(p0, p1, p2, p3) } diff --git a/venus-shared/api/gateway/v1/method.md b/venus-shared/api/gateway/v1/method.md index 2fc313a689..79e9224ff3 100644 --- a/venus-shared/api/gateway/v1/method.md +++ b/venus-shared/api/gateway/v1/method.md @@ -205,7 +205,7 @@ Inputs: ], "Bw==", 10101, - 23 + 24 ] ``` diff --git a/venus-shared/api/gateway/v2/method.md b/venus-shared/api/gateway/v2/method.md index 8fb9193b0d..2d0f4589fc 100644 --- a/venus-shared/api/gateway/v2/method.md +++ b/venus-shared/api/gateway/v2/method.md @@ -174,7 +174,7 @@ Inputs: ], "Bw==", 10101, - 23 + 24 ] ``` diff --git a/venus-shared/compatible-checks/api-diff.txt b/venus-shared/compatible-checks/api-diff.txt index 470523c2f6..dde37e80b8 100644 --- a/venus-shared/compatible-checks/api-diff.txt +++ b/venus-shared/compatible-checks/api-diff.txt @@ -65,7 +65,7 @@ github.com/filecoin-project/venus/venus-shared/api/chain/v0.FullNode <> github.c - Shutdown - StateGetAllAllocations - StateGetAllClaims - > StateGetNetworkParams {[func(context.Context) (*types.NetworkParams, error) <> func(context.Context) (*api.NetworkParams, error)] base=func out type: #0 input; nested={[*types.NetworkParams <> *api.NetworkParams] base=pointed type; nested={[types.NetworkParams <> api.NetworkParams] base=struct field; nested={[types.NetworkParams <> api.NetworkParams] base=exported field type: #5 field named ForkUpgradeParams; nested={[types.ForkUpgradeParams <> api.ForkUpgradeParams] base=struct field; nested={[types.ForkUpgradeParams <> api.ForkUpgradeParams] base=exported fields count: 28 != 29; nested=nil}}}}}} + + StateMinerInitialPledgeForSector + StateMinerSectorSize + StateMinerWorkerAddress - SyncCheckBad @@ -165,8 +165,6 @@ github.com/filecoin-project/venus/venus-shared/api/chain/v1.FullNode <> github.c + SetConcurrent + SetPassword - Shutdown - > StateGetNetworkParams {[func(context.Context) (*types.NetworkParams, error) <> func(context.Context) (*api.NetworkParams, error)] base=func out type: #0 input; nested={[*types.NetworkParams <> *api.NetworkParams] base=pointed type; nested={[types.NetworkParams <> api.NetworkParams] base=struct field; nested={[types.NetworkParams <> api.NetworkParams] base=exported field type: #5 field named ForkUpgradeParams; nested={[types.ForkUpgradeParams <> api.ForkUpgradeParams] base=struct field; nested={[types.ForkUpgradeParams <> api.ForkUpgradeParams] base=exported fields count: 28 != 29; nested=nil}}}}}} - - StateMinerInitialPledgeForSector + StateMinerSectorSize + StateMinerWorkerAddress - SyncCheckBad diff --git a/venus-shared/compatible-checks/api-perm.txt b/venus-shared/compatible-checks/api-perm.txt index 1abfaa8248..9c3dc6ae5b 100644 --- a/venus-shared/compatible-checks/api-perm.txt +++ b/venus-shared/compatible-checks/api-perm.txt @@ -11,6 +11,7 @@ v0: github.com/filecoin-project/venus/venus-shared/api/chain/v0 <> github.com/fi - IChainInfo.ProtocolParameters - IChainInfo.ResolveToKeyAddr - IChainInfo.VerifyEntry + - IMinerState.StateMinerInitialPledgeForSector - IMinerState.StateMinerSectorSize - IMinerState.StateMinerWorkerAddress - ICommon.StartTime