Get State API almost working
This commit is contained in:
parent
053cfc1cc7
commit
31ff5230bb
@ -325,6 +325,8 @@ type FullNode interface {
|
|||||||
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*MinerPower, error)
|
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*MinerPower, error)
|
||||||
// StateMinerInfo returns info about the indicated miner
|
// StateMinerInfo returns info about the indicated miner
|
||||||
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error)
|
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error)
|
||||||
|
// StateMinerDeadlines returns all the proving deadlines for the given miner
|
||||||
|
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]*miner.Deadline, error)
|
||||||
// StateMinerFaults returns a bitfield indicating the faulty sectors of the given miner
|
// StateMinerFaults returns a bitfield indicating the faulty sectors of the given miner
|
||||||
StateMinerFaults(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error)
|
StateMinerFaults(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error)
|
||||||
// StateAllMinerFaults returns all non-expired Faults that occur within lookback epochs of the given tipset
|
// StateAllMinerFaults returns all non-expired Faults that occur within lookback epochs of the given tipset
|
||||||
|
|||||||
@ -167,6 +167,7 @@ type FullNodeStruct struct {
|
|||||||
StateMinerProvingDeadline func(context.Context, address.Address, types.TipSetKey) (*dline.Info, error) `perm:"read"`
|
StateMinerProvingDeadline func(context.Context, address.Address, types.TipSetKey) (*dline.Info, error) `perm:"read"`
|
||||||
StateMinerPower func(context.Context, address.Address, types.TipSetKey) (*api.MinerPower, error) `perm:"read"`
|
StateMinerPower func(context.Context, address.Address, types.TipSetKey) (*api.MinerPower, error) `perm:"read"`
|
||||||
StateMinerInfo func(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error) `perm:"read"`
|
StateMinerInfo func(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error) `perm:"read"`
|
||||||
|
StateMinerDeadlines func(context.Context, address.Address, types.TipSetKey) ([]*miner.Deadline, error) `perm:"read"`
|
||||||
StateMinerFaults func(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error) `perm:"read"`
|
StateMinerFaults func(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error) `perm:"read"`
|
||||||
StateAllMinerFaults func(context.Context, abi.ChainEpoch, types.TipSetKey) ([]*api.Fault, error) `perm:"read"`
|
StateAllMinerFaults func(context.Context, abi.ChainEpoch, types.TipSetKey) ([]*api.Fault, error) `perm:"read"`
|
||||||
StateMinerRecoveries func(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error) `perm:"read"`
|
StateMinerRecoveries func(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error) `perm:"read"`
|
||||||
@ -751,6 +752,10 @@ func (c *FullNodeStruct) StateMinerInfo(ctx context.Context, actor address.Addre
|
|||||||
return c.Internal.StateMinerInfo(ctx, actor, tsk)
|
return c.Internal.StateMinerInfo(ctx, actor, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *FullNodeStruct) StateMinerDeadlines(ctx context.Context, actor address.Address, tsk types.TipSetKey) ([]*miner.Deadline, error) {
|
||||||
|
return c.Internal.StateMinerDeadlines(ctx, actor, tsk)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMinerFaults(ctx context.Context, actor address.Address, tsk types.TipSetKey) (bitfield.BitField, error) {
|
func (c *FullNodeStruct) StateMinerFaults(ctx context.Context, actor address.Address, tsk types.TipSetKey) (bitfield.BitField, error) {
|
||||||
return c.Internal.StateMinerFaults(ctx, actor, tsk)
|
return c.Internal.StateMinerFaults(ctx, actor, tsk)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,9 @@ func Load(store adt.Store, act *types.Actor) (st State, err error) {
|
|||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
|
AvailableBalance(abi.TokenAmount) (abi.TokenAmount, error)
|
||||||
|
VestedFunds(abi.ChainEpoch) (abi.TokenAmount, error)
|
||||||
|
|
||||||
GetSector(abi.SectorNumber) (*SectorOnChainInfo, error)
|
GetSector(abi.SectorNumber) (*SectorOnChainInfo, error)
|
||||||
FindSector(abi.SectorNumber) (*SectorLocation, error)
|
FindSector(abi.SectorNumber) (*SectorLocation, error)
|
||||||
GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error)
|
GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error)
|
||||||
|
|||||||
@ -31,6 +31,14 @@ type v0Partition struct {
|
|||||||
store adt.Store
|
store adt.Store
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *v0State) AvailableBalance(bal abi.TokenAmount) (abi.TokenAmount, error) {
|
||||||
|
return s.GetAvailableBalance(bal), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *v0State) VestedFunds(epoch abi.ChainEpoch) (abi.TokenAmount, error) {
|
||||||
|
return s.CheckVestedFunds(s.store, epoch)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *v0State) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) {
|
func (s *v0State) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) {
|
||||||
info, ok, err := s.State.GetSector(s.store, num)
|
info, ok, err := s.State.GetSector(s.store, num)
|
||||||
if !ok || err != nil {
|
if !ok || err != nil {
|
||||||
|
|||||||
@ -31,5 +31,7 @@ type State interface {
|
|||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
RewardSmoothed() (builtin.FilterEstimate, error)
|
RewardSmoothed() (builtin.FilterEstimate, error)
|
||||||
TotalStoragePowerReward() abi.TokenAmount
|
EffectiveBaselinePower() (abi.StoragePower, error)
|
||||||
|
ThisEpochBaselinePower() (abi.StoragePower, error)
|
||||||
|
TotalStoragePowerReward() (abi.TokenAmount, error)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,14 @@ func (s *v0State) RewardSmoothed() (builtin.FilterEstimate, error) {
|
|||||||
return *s.State.ThisEpochRewardSmoothed, nil
|
return *s.State.ThisEpochRewardSmoothed, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *v0State) TotalStoragePowerReward() abi.TokenAmount {
|
func (s *v0State) TotalStoragePowerReward() (abi.TokenAmount, error) {
|
||||||
return s.State.TotalMined
|
return s.State.TotalMined, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *v0State) EffectiveBaselinePower() (abi.StoragePower, error) {
|
||||||
|
return s.State.EffectiveBaselinePower, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *v0State) ThisEpochBaselinePower() (abi.StoragePower, error) {
|
||||||
|
return s.State.ThisEpochBaselinePower, nil
|
||||||
}
|
}
|
||||||
|
|||||||
37
chain/actors/builtin/verifreg/v0.go
Normal file
37
chain/actors/builtin/verifreg/v0.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package verifreg
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
|
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||||
|
v0adt "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
)
|
||||||
|
|
||||||
|
type v0State struct {
|
||||||
|
v0verifreg.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *v0State) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||||
|
if addr.Protocol() != address.ID {
|
||||||
|
return false, big.Zero(), xerrors.Errorf("can only look up ID addresses")
|
||||||
|
}
|
||||||
|
|
||||||
|
vh, err := v0adt.AsMap(s.store, s.VerifiedClients)
|
||||||
|
if err != nil {
|
||||||
|
return false, big.Zero(), xerrors.Errorf("loading verified clients: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var dcap abi.StoragePower
|
||||||
|
if found, err := vh.Get(abi.AddrKey(addr), &dcap); err != nil {
|
||||||
|
return false, big.Zero(), xerrors.Errorf("looking up verified clients: %w", err)
|
||||||
|
} else if !found {
|
||||||
|
return false, big.Zero(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, dcap, nil
|
||||||
|
}
|
||||||
34
chain/actors/builtin/verifreg/verifreg.go
Normal file
34
chain/actors/builtin/verifreg/verifreg.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package verifreg
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
|
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var Address = v0builtin.VerifiedRegistryActorAddr
|
||||||
|
|
||||||
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
switch act.Code {
|
||||||
|
case v0builtin.VerifiedRegistryActorCodeID:
|
||||||
|
out := v0State{store: store}
|
||||||
|
err := store.Get(store.Context(), act.Head, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
|
}
|
||||||
|
|
||||||
|
type State interface {
|
||||||
|
cbor.Marshaler
|
||||||
|
|
||||||
|
VerifiedClientDataCap(address.Address) (bool, abi.StoragePower, error)
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package stmgr
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
|
|||||||
@ -1029,7 +1029,7 @@ func GetFilMined(ctx context.Context, st *state.StateTree) (abi.TokenAmount, err
|
|||||||
return big.Zero(), xerrors.Errorf("failed to load reward state: %w", err)
|
return big.Zero(), xerrors.Errorf("failed to load reward state: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return rst.TotalStoragePowerReward(), nil
|
return rst.TotalStoragePowerReward()
|
||||||
}
|
}
|
||||||
|
|
||||||
func getFilMarketLocked(ctx context.Context, st *state.StateTree) (abi.TokenAmount, error) {
|
func getFilMarketLocked(ctx context.Context, st *state.StateTree) (abi.TokenAmount, error) {
|
||||||
|
|||||||
@ -9,6 +9,10 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
v0init "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||||
|
v0market "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||||
|
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||||
|
|
||||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
|
|
||||||
saruntime "github.com/filecoin-project/specs-actors/actors/runtime"
|
saruntime "github.com/filecoin-project/specs-actors/actors/runtime"
|
||||||
@ -541,12 +545,12 @@ var MethodsMap = map[cid.Cid]map[abi.MethodNum]MethodMeta{}
|
|||||||
func init() {
|
func init() {
|
||||||
cidToMethods := map[cid.Cid][2]interface{}{
|
cidToMethods := map[cid.Cid][2]interface{}{
|
||||||
// builtin.SystemActorCodeID: {builtin.MethodsSystem, system.Actor{} }- apparently it doesn't have methods
|
// builtin.SystemActorCodeID: {builtin.MethodsSystem, system.Actor{} }- apparently it doesn't have methods
|
||||||
builtin.InitActorCodeID: {builtin.MethodsInit, init_.Actor{}},
|
builtin.InitActorCodeID: {builtin.MethodsInit, v0init.Actor{}},
|
||||||
builtin.CronActorCodeID: {builtin.MethodsCron, cron.Actor{}},
|
builtin.CronActorCodeID: {builtin.MethodsCron, cron.Actor{}},
|
||||||
builtin.AccountActorCodeID: {builtin.MethodsAccount, account.Actor{}},
|
builtin.AccountActorCodeID: {builtin.MethodsAccount, account.Actor{}},
|
||||||
builtin.StoragePowerActorCodeID: {builtin.MethodsPower, power.Actor{}},
|
builtin.StoragePowerActorCodeID: {builtin.MethodsPower, v0power.Actor{}},
|
||||||
builtin.StorageMinerActorCodeID: {builtin.MethodsMiner, miner.Actor{}},
|
builtin.StorageMinerActorCodeID: {builtin.MethodsMiner, v0miner.Actor{}},
|
||||||
builtin.StorageMarketActorCodeID: {builtin.MethodsMarket, market.Actor{}},
|
builtin.StorageMarketActorCodeID: {builtin.MethodsMarket, v0market.Actor{}},
|
||||||
builtin.PaymentChannelActorCodeID: {builtin.MethodsPaych, paych.Actor{}},
|
builtin.PaymentChannelActorCodeID: {builtin.MethodsPaych, paych.Actor{}},
|
||||||
builtin.MultisigActorCodeID: {builtin.MethodsMultisig, v0msig.Actor{}},
|
builtin.MultisigActorCodeID: {builtin.MethodsMultisig, v0msig.Actor{}},
|
||||||
builtin.RewardActorCodeID: {builtin.MethodsReward, v0reward.Actor{}},
|
builtin.RewardActorCodeID: {builtin.MethodsReward, v0reward.Actor{}},
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package sub
|
package sub
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|||||||
@ -33,9 +33,9 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
lapi "github.com/filecoin-project/lotus/api"
|
lapi "github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/lib/tablewriter"
|
"github.com/filecoin-project/lotus/lib/tablewriter"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var CidBaseFlag = cli.StringFlag{
|
var CidBaseFlag = cli.StringFlag{
|
||||||
@ -417,7 +417,7 @@ var clientDealCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
isVerified := dcap != nil
|
isVerified := dcap != types.EmptyInt
|
||||||
|
|
||||||
// If the user has explicitly set the --verified-deal flag
|
// If the user has explicitly set the --verified-deal flag
|
||||||
if cctx.IsSet("verified-deal") {
|
if cctx.IsSet("verified-deal") {
|
||||||
@ -1044,8 +1044,8 @@ var clientListDeals = &cli.Command{
|
|||||||
func dealFromDealInfo(ctx context.Context, full api.FullNode, head *types.TipSet, v api.DealInfo) deal {
|
func dealFromDealInfo(ctx context.Context, full api.FullNode, head *types.TipSet, v api.DealInfo) deal {
|
||||||
if v.DealID == 0 {
|
if v.DealID == 0 {
|
||||||
return deal{
|
return deal{
|
||||||
LocalDeal: v,
|
LocalDeal: v,
|
||||||
OnChainDealState: *market.EmptyDealState()
|
OnChainDealState: *market.EmptyDealState(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ var provingFaultsCmd = &cli.Command{
|
|||||||
_, _ = fmt.Fprintln(tw, "deadline\tpartition\tsectors")
|
_, _ = fmt.Fprintln(tw, "deadline\tpartition\tsectors")
|
||||||
err = mas.ForEachDeadline(func(dlIdx uint64, dl miner.Deadline) error {
|
err = mas.ForEachDeadline(func(dlIdx uint64, dl miner.Deadline) error {
|
||||||
dl.ForEachPartition(func(partIdx uint64, part miner.Partition) error {
|
dl.ForEachPartition(func(partIdx uint64, part miner.Partition) error {
|
||||||
faults, err := part.Faults()
|
faults, err := part.FaultySectors()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ var provingInfoCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if bf, err := part.Faults(); err != nil {
|
if bf, err := part.FaultySectors(); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if count, err := bf.Count(); err != nil {
|
} else if count, err := bf.Count(); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -166,7 +166,7 @@ var provingInfoCmd = &cli.Command{
|
|||||||
faults += count
|
faults += count
|
||||||
}
|
}
|
||||||
|
|
||||||
if bf, err := part.Recovering(); err != nil {
|
if bf, err := part.RecoveringSectors(); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if count, err := bf.Count(); err != nil {
|
} else if count, err := bf.Count(); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -286,14 +286,14 @@ var provingDeadlinesCmd = &cli.Command{
|
|||||||
faults := uint64(0)
|
faults := uint64(0)
|
||||||
|
|
||||||
for _, partition := range partitions {
|
for _, partition := range partitions {
|
||||||
sc, err := partition.Sectors.Count()
|
sc, err := partition.AllSectors.Count()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
sectors += sc
|
sectors += sc
|
||||||
|
|
||||||
fc, err := partition.Faults.Count()
|
fc, err := partition.FaultySectors.Count()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,8 +8,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -362,12 +360,14 @@ func (n *ProviderNodeAdapter) WaitForMessage(ctx context.Context, mcid cid.Cid,
|
|||||||
return cb(receipt.Receipt.ExitCode, receipt.Receipt.Return, receipt.Message, nil)
|
return cb(receipt.Receipt.ExitCode, receipt.Receipt.Return, receipt.Message, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) GetDataCap(ctx context.Context, addr address.Address, encodedTs shared.TipSetToken) (abi.StoragePower, error) {
|
func (n *ProviderNodeAdapter) GetDataCap(ctx context.Context, addr address.Address, encodedTs shared.TipSetToken) (*abi.StoragePower, error) {
|
||||||
tsk, err := types.TipSetKeyFromBytes(encodedTs)
|
tsk, err := types.TipSetKeyFromBytes(encodedTs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return big.Zero(), err
|
return nil, err
|
||||||
}
|
}
|
||||||
return n.StateVerifiedClientStatus(ctx, addr, tsk)
|
|
||||||
|
sp, err := n.StateVerifiedClientStatus(ctx, addr, tsk)
|
||||||
|
return &sp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) OnDealExpiredOrSlashed(ctx context.Context, dealID abi.DealID, onDealExpired storagemarket.DealExpiredCallback, onDealSlashed storagemarket.DealSlashedCallback) error {
|
func (n *ProviderNodeAdapter) OnDealExpiredOrSlashed(ctx context.Context, dealID abi.DealID, onDealExpired storagemarket.DealExpiredCallback, onDealSlashed storagemarket.DealSlashedCallback) error {
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
v0market "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/verifreg"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/verifreg"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
@ -73,6 +75,11 @@ func (a *StateAPI) StateMinerSectors(ctx context.Context, addr address.Address,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*miner.ChainSectorInfo, error) { // TODO: only used in cli
|
func (a *StateAPI) StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*miner.ChainSectorInfo, error) { // TODO: only used in cli
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
|
|
||||||
act, err := a.StateManager.LoadActorTsk(ctx, maddr, tsk)
|
act, err := a.StateManager.LoadActorTsk(ctx, maddr, tsk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to load miner actor: %w", err)
|
return nil, xerrors.Errorf("failed to load miner actor: %w", err)
|
||||||
@ -88,7 +95,7 @@ func (a *StateAPI) StateMinerActiveSectors(ctx context.Context, maddr address.Ad
|
|||||||
return nil, xerrors.Errorf("merge partition active sets: %w", err)
|
return nil, xerrors.Errorf("merge partition active sets: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return mas.LoadSectorsFromSet(&activeSectors, false)
|
return stmgr.GetMinerSectorSet(ctx, a.StateManager, ts, maddr, &activeSectors, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerInfo(ctx context.Context, actor address.Address, tsk types.TipSetKey) (miner.MinerInfo, error) {
|
func (a *StateAPI) StateMinerInfo(ctx context.Context, actor address.Address, tsk types.TipSetKey) (miner.MinerInfo, error) {
|
||||||
@ -105,7 +112,7 @@ func (a *StateAPI) StateMinerInfo(ctx context.Context, actor address.Address, ts
|
|||||||
return mas.Info()
|
return mas.Info()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerDeadlines(ctx context.Context, m address.Address, tsk types.TipSetKey) ([]miner.Deadline, error) {
|
func (a *StateAPI) StateMinerDeadlines(ctx context.Context, m address.Address, tsk types.TipSetKey) ([]*miner.Deadline, error) {
|
||||||
act, err := a.StateManager.LoadActorTsk(ctx, m, tsk)
|
act, err := a.StateManager.LoadActorTsk(ctx, m, tsk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to load miner actor: %w", err)
|
return nil, xerrors.Errorf("failed to load miner actor: %w", err)
|
||||||
@ -121,9 +128,9 @@ func (a *StateAPI) StateMinerDeadlines(ctx context.Context, m address.Address, t
|
|||||||
return nil, xerrors.Errorf("getting deadline count: %w", err)
|
return nil, xerrors.Errorf("getting deadline count: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
out := make([]miner.Deadline, deadlines)
|
out := make([]*miner.Deadline, deadlines)
|
||||||
if err := mas.ForEachDeadline(func(i uint64, dl miner.Deadline) error {
|
if err := mas.ForEachDeadline(func(i uint64, dl miner.Deadline) error {
|
||||||
out[i] = dl
|
out[i] = &dl
|
||||||
return nil
|
return nil
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -671,12 +678,18 @@ func (a *StateAPI) StateMinerSectorCount(ctx context.Context, addr address.Addre
|
|||||||
return api.MinerSectors{Live: liveCount, Active: activeCount, Faulty: faultyCount}, nil
|
return api.MinerSectors{Live: liveCount, Active: activeCount, Faulty: faultyCount}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) {
|
func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) {
|
||||||
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
return miner.SectorPreCommitOnChainInfo{}, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
}
|
}
|
||||||
return stmgr.PreCommitInfo(ctx, a.StateManager, maddr, n, ts)
|
|
||||||
|
pci, err := stmgr.PreCommitInfo(ctx, a.StateManager, maddr, n, ts)
|
||||||
|
if err != nil {
|
||||||
|
return miner.SectorPreCommitOnChainInfo{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return *pci, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error) {
|
func (a *StateAPI) StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error) {
|
||||||
@ -873,7 +886,7 @@ func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr
|
|||||||
// NB: not exactly accurate, but should always lead us to *over* estimate, not under
|
// NB: not exactly accurate, but should always lead us to *over* estimate, not under
|
||||||
duration := pci.Expiration - ts.Height()
|
duration := pci.Expiration - ts.Height()
|
||||||
|
|
||||||
// TODO: handle changes to this function across actor upgrades.
|
// TODO: ActorUpgrade
|
||||||
sectorWeight = v0miner.QAPowerForWeight(ssize, duration, w, vw)
|
sectorWeight = v0miner.QAPowerForWeight(ssize, duration, w, vw)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -899,8 +912,8 @@ func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr
|
|||||||
rewardSmoothed = r
|
rewardSmoothed = r
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: abstract over network upgrades.
|
// TODO: ActorUpgrade
|
||||||
deposit := v0miner.PreCommitDepositForPower(rewardSmoothed, powerSmoothed, sectorWeight)
|
deposit := v0miner.PreCommitDepositForPower(&rewardSmoothed, &powerSmoothed, sectorWeight)
|
||||||
|
|
||||||
return types.BigDiv(types.BigMul(deposit, initialPledgeNum), initialPledgeDen), nil
|
return types.BigDiv(types.BigMul(deposit, initialPledgeNum), initialPledgeDen), nil
|
||||||
}
|
}
|
||||||
@ -940,8 +953,8 @@ func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
powerSmoothed smoothing.FilterEstimate
|
powerSmoothed smoothing.FilterEstimate
|
||||||
pledgeCollerateral abi.TokenAmount
|
pledgeCollateral abi.TokenAmount
|
||||||
)
|
)
|
||||||
if act, err := state.GetActor(power.Address); err != nil {
|
if act, err := state.GetActor(power.Address); err != nil {
|
||||||
return types.EmptyInt, xerrors.Errorf("loading miner actor: %w", err)
|
return types.EmptyInt, xerrors.Errorf("loading miner actor: %w", err)
|
||||||
@ -966,26 +979,26 @@ func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr
|
|||||||
return types.EmptyInt, xerrors.Errorf("loading reward actor state: %w", err)
|
return types.EmptyInt, xerrors.Errorf("loading reward actor state: %w", err)
|
||||||
} else if r, err := s.RewardSmoothed(); err != nil {
|
} else if r, err := s.RewardSmoothed(); err != nil {
|
||||||
return types.EmptyInt, xerrors.Errorf("failed to determine total reward: %w", err)
|
return types.EmptyInt, xerrors.Errorf("failed to determine total reward: %w", err)
|
||||||
} else if p, err := s.BaselinePower(); err != nil {
|
} else if p, err := s.ThisEpochBaselinePower(); err != nil {
|
||||||
return types.EmptyInt, xerrors.Errorf("failed to determine baseline power: %w", err)
|
return types.EmptyInt, xerrors.Errorf("failed to determine baseline power: %w", err)
|
||||||
} else {
|
} else {
|
||||||
rewardSmoothed = r
|
rewardSmoothed = r
|
||||||
baselinePower = p
|
baselinePower = p
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: abstract over network upgrades.
|
|
||||||
|
|
||||||
circSupply, err := a.StateCirculatingSupply(ctx, ts.Key())
|
circSupply, err := a.StateCirculatingSupply(ctx, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return big.Zero(), xerrors.Errorf("getting circulating supply: %w", err)
|
return big.Zero(), xerrors.Errorf("getting circulating supply: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
initialPledge := miner.InitialPledgeForPower(
|
// TODO: ActorUpgrade
|
||||||
|
|
||||||
|
initialPledge := v0miner.InitialPledgeForPower(
|
||||||
sectorWeight,
|
sectorWeight,
|
||||||
baselinePower,
|
baselinePower,
|
||||||
pledgeCollateral,
|
pledgeCollateral,
|
||||||
rewardSmoothed,
|
&rewardSmoothed,
|
||||||
powerSmoothed,
|
&powerSmoothed,
|
||||||
circSupply.FilCirculating,
|
circSupply.FilCirculating,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -998,23 +1011,27 @@ func (a *StateAPI) StateMinerAvailableBalance(ctx context.Context, maddr address
|
|||||||
return types.EmptyInt, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
return types.EmptyInt, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var act *types.Actor
|
act, err := a.StateManager.LoadActor(ctx, maddr, ts)
|
||||||
var mas miner.State
|
if err != nil {
|
||||||
|
return types.EmptyInt, xerrors.Errorf("failed to load miner actor: %w", err)
|
||||||
if err := a.StateManager.WithParentState(ts, a.StateManager.WithActor(maddr, func(actor *types.Actor) error {
|
|
||||||
act = actor
|
|
||||||
return a.StateManager.WithActorState(ctx, &mas)(actor)
|
|
||||||
})); err != nil {
|
|
||||||
return types.BigInt{}, xerrors.Errorf("getting miner state: %w", err)
|
|
||||||
}
|
}
|
||||||
as := store.ActorStore(ctx, a.Chain.Blockstore())
|
|
||||||
|
|
||||||
vested, err := mas.CheckVestedFunds(as, ts.Height())
|
mas, err := miner.Load(a.StateManager.ChainStore().Store(ctx), act)
|
||||||
|
if err != nil {
|
||||||
|
return types.EmptyInt, xerrors.Errorf("failed to load miner actor state: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
vested, err := mas.VestedFunds(ts.Height())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.EmptyInt, err
|
return types.EmptyInt, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return types.BigAdd(mas.GetAvailableBalance(act.Balance), vested), nil
|
abal, err := mas.AvailableBalance(act.Balance)
|
||||||
|
if err != nil {
|
||||||
|
return types.EmptyInt, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return types.BigAdd(abal, vested), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StateVerifiedClientStatus returns the data cap for the given address.
|
// StateVerifiedClientStatus returns the data cap for the given address.
|
||||||
@ -1023,23 +1040,23 @@ func (a *StateAPI) StateMinerAvailableBalance(ctx context.Context, maddr address
|
|||||||
func (a *StateAPI) StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (abi.StoragePower, error) {
|
func (a *StateAPI) StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (abi.StoragePower, error) {
|
||||||
act, err := a.StateGetActor(ctx, builtin.VerifiedRegistryActorAddr, tsk)
|
act, err := a.StateGetActor(ctx, builtin.VerifiedRegistryActorAddr, tsk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return big.Zero(), err
|
return types.EmptyInt, err
|
||||||
}
|
}
|
||||||
|
|
||||||
aid, err := a.StateLookupID(ctx, addr, tsk)
|
aid, err := a.StateLookupID(ctx, addr, tsk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("lookup failure %v", err)
|
log.Warnf("lookup failure %v", err)
|
||||||
return big.Zero(), err
|
return types.EmptyInt, err
|
||||||
}
|
}
|
||||||
|
|
||||||
vrs, err := verifreg.Load(a.StateManager.ChainStore().Store(ctx), act)
|
vrs, err := verifreg.Load(a.StateManager.ChainStore().Store(ctx), act)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return big.Zero(), xerrors.Errorf("failed to load verified registry state: %w", err)
|
return types.EmptyInt, xerrors.Errorf("failed to load verified registry state: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, dcap, err := vrs.VerifiedClientDataCap(aid)
|
_, dcap, err := vrs.VerifiedClientDataCap(aid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return big.Zero(), xerrors.Errorf("looking up verified client: %w", err)
|
return types.EmptyInt, xerrors.Errorf("looking up verified client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return dcap, nil
|
return dcap, nil
|
||||||
@ -1056,23 +1073,24 @@ func (a *StateAPI) StateDealProviderCollateralBounds(ctx context.Context, size a
|
|||||||
return api.DealCollateralBounds{}, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
return api.DealCollateralBounds{}, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var powerState power.State
|
pact, err := a.StateGetActor(ctx, builtin.StoragePowerActorAddr, tsk)
|
||||||
var rewardState reward.State
|
|
||||||
|
|
||||||
err = a.StateManager.WithParentStateTsk(ts.Key(), func(state *state.StateTree) error {
|
|
||||||
if err := a.StateManager.WithActor(builtin.StoragePowerActorAddr, a.StateManager.WithActorState(ctx, &powerState))(state); err != nil {
|
|
||||||
return xerrors.Errorf("getting power state: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := a.StateManager.WithActor(builtin.RewardActorAddr, a.StateManager.WithActorState(ctx, &rewardState))(state); err != nil {
|
|
||||||
return xerrors.Errorf("getting reward state: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return api.DealCollateralBounds{}, xerrors.Errorf("getting power and reward actor states: %w", err)
|
return api.DealCollateralBounds{}, xerrors.Errorf("failed to load power actor: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ract, err := a.StateGetActor(ctx, builtin.RewardActorAddr, tsk)
|
||||||
|
if err != nil {
|
||||||
|
return api.DealCollateralBounds{}, xerrors.Errorf("failed to load reward actor: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pst, err := power.Load(a.StateManager.ChainStore().Store(ctx), pact)
|
||||||
|
if err != nil {
|
||||||
|
return api.DealCollateralBounds{}, xerrors.Errorf("failed to load power actor state: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
rst, err := reward.Load(a.StateManager.ChainStore().Store(ctx), ract)
|
||||||
|
if err != nil {
|
||||||
|
return api.DealCollateralBounds{}, xerrors.Errorf("failed to load reward actor state: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
circ, err := a.StateCirculatingSupply(ctx, ts.Key())
|
circ, err := a.StateCirculatingSupply(ctx, ts.Key())
|
||||||
@ -1080,11 +1098,21 @@ func (a *StateAPI) StateDealProviderCollateralBounds(ctx context.Context, size a
|
|||||||
return api.DealCollateralBounds{}, xerrors.Errorf("getting total circulating supply: %w", err)
|
return api.DealCollateralBounds{}, xerrors.Errorf("getting total circulating supply: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
min, max := market.DealProviderCollateralBounds(size,
|
powClaim, err := pst.TotalPower()
|
||||||
|
if err != nil {
|
||||||
|
return api.DealCollateralBounds{}, xerrors.Errorf("getting total power: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
rewPow, err := rst.ThisEpochBaselinePower()
|
||||||
|
if err != nil {
|
||||||
|
return api.DealCollateralBounds{}, xerrors.Errorf("getting reward baseline power: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
min, max := v0market.DealProviderCollateralBounds(size,
|
||||||
verified,
|
verified,
|
||||||
powerState.TotalRawBytePower,
|
powClaim.RawBytePower,
|
||||||
powerState.ThisEpochQualityAdjPower,
|
powClaim.QualityAdjPower,
|
||||||
rewardState.ThisEpochBaselinePower,
|
rewPow,
|
||||||
circ.FilCirculating,
|
circ.FilCirculating,
|
||||||
a.StateManager.GetNtwkVersion(ctx, ts.Height()))
|
a.StateManager.GetNtwkVersion(ctx, ts.Height()))
|
||||||
return api.DealCollateralBounds{
|
return api.DealCollateralBounds{
|
||||||
@ -1109,7 +1137,7 @@ func (a *StateAPI) StateCirculatingSupply(ctx context.Context, tsk types.TipSetK
|
|||||||
func (a *StateAPI) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error) {
|
func (a *StateAPI) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error) {
|
||||||
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
return network.VersionMax, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return a.StateManager.GetNtwkVersion(ctx, ts.Height()), nil
|
return a.StateManager.GetNtwkVersion(ctx, ts.Height()), nil
|
||||||
|
|||||||
@ -328,7 +328,7 @@ func (sm *StorageMinerAPI) listDeals(ctx context.Context) ([]api.MarketDeal, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) MarketListDeals(ctx context.Context) ([]api.MarketDeal, error) {
|
func (sm *StorageMinerAPI) MarketListDeals(ctx context.Context) ([]api.MarketDeal, error) {
|
||||||
return sm.StorageProvider.listDeals(ctx)
|
return sm.listDeals(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) MarketListRetrievalDeals(ctx context.Context) ([]retrievalmarket.ProviderDealState, error) {
|
func (sm *StorageMinerAPI) MarketListRetrievalDeals(ctx context.Context) ([]retrievalmarket.ProviderDealState, error) {
|
||||||
|
|||||||
@ -84,7 +84,7 @@ func (s SealingAPIAdapter) StateMinerWorkerAddress(ctx context.Context, maddr ad
|
|||||||
return mi.Worker, nil
|
return mi.Worker, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s SealingAPIAdapter) StateMinerDeadlines(ctx context.Context, maddr address.Address, tok sealing.TipSetToken) ([]miner.Deadline, error) {
|
func (s SealingAPIAdapter) StateMinerDeadlines(ctx context.Context, maddr address.Address, tok sealing.TipSetToken) ([]*miner.Deadline, error) {
|
||||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||||
@ -251,7 +251,7 @@ func (s SealingAPIAdapter) StateMarketStorageDeal(ctx context.Context, dealID ab
|
|||||||
func (s SealingAPIAdapter) StateNetworkVersion(ctx context.Context, tok sealing.TipSetToken) (network.Version, error) {
|
func (s SealingAPIAdapter) StateNetworkVersion(ctx context.Context, tok sealing.TipSetToken) (network.Version, error) {
|
||||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, err
|
return network.VersionMax, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return s.delegate.StateNetworkVersion(ctx, tsk)
|
return s.delegate.StateNetworkVersion(ctx, tsk)
|
||||||
|
|||||||
@ -3,12 +3,13 @@ package storage
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ type addrSelectApi interface {
|
|||||||
StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddressFor(ctx context.Context, a addrSelectApi, mi api.MinerInfo, use AddrUse, minFunds abi.TokenAmount) (address.Address, error) {
|
func AddressFor(ctx context.Context, a addrSelectApi, mi miner.MinerInfo, use AddrUse, minFunds abi.TokenAmount) (address.Address, error) {
|
||||||
switch use {
|
switch use {
|
||||||
case PreCommitAddr, CommitAddr:
|
case PreCommitAddr, CommitAddr:
|
||||||
// always use worker, at least for now
|
// always use worker, at least for now
|
||||||
|
|||||||
@ -76,7 +76,7 @@ type storageMinerApi interface {
|
|||||||
StateSectorGetInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorOnChainInfo, error)
|
StateSectorGetInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorOnChainInfo, error)
|
||||||
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*miner.SectorLocation, error)
|
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*miner.SectorLocation, error)
|
||||||
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error)
|
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error)
|
||||||
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]miner.Deadline, error)
|
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]*miner.Deadline, error)
|
||||||
StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error)
|
StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error)
|
||||||
StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (types.BigInt, error)
|
StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (types.BigInt, error)
|
||||||
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (types.BigInt, error)
|
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (types.BigInt, error)
|
||||||
|
|||||||
@ -4,8 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user