Fix lotus/miner build
This commit is contained in:
parent
f4e46c9003
commit
deb2b90b6a
@ -39,6 +39,8 @@ type ChainIO interface {
|
||||
ChainHasObj(context.Context, cid.Cid) (bool, error)
|
||||
}
|
||||
|
||||
const LookbackNoLimit = abi.ChainEpoch(-1)
|
||||
|
||||
// FullNode API is a low-level interface to the Filecoin network full node
|
||||
type FullNode interface {
|
||||
Common
|
||||
|
@ -16,6 +16,8 @@ type StorageMinerStruct = api.StorageMinerStruct
|
||||
type Worker = api.Worker
|
||||
type WorkerStruct = api.WorkerStruct
|
||||
|
||||
type Wallet = api.Wallet
|
||||
|
||||
func PermissionedStorMinerAPI(a StorageMiner) StorageMiner {
|
||||
return api.PermissionedStorMinerAPI(a)
|
||||
}
|
||||
|
21
api/wrap.go
Normal file
21
api/wrap.go
Normal file
@ -0,0 +1,21 @@
|
||||
package api
|
||||
|
||||
import "reflect"
|
||||
|
||||
// Wrap adapts partial api impl to another version
|
||||
// proxyT is the proxy type used as input in wrapperT
|
||||
// Usage: Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), eventsApi).(EventAPI)
|
||||
func Wrap(proxyT, wrapperT, impl interface{}) interface{} {
|
||||
proxy := reflect.New(reflect.TypeOf(proxyT).Elem())
|
||||
proxyMethods := proxy.FieldByName("Internal")
|
||||
ri := reflect.ValueOf(impl)
|
||||
|
||||
for i := 0; i < ri.NumMethod(); i++ {
|
||||
mt := ri.Type().Method(i)
|
||||
proxyMethods.FieldByName(mt.Name).Set(ri.Method(i))
|
||||
}
|
||||
|
||||
wp := reflect.New(reflect.TypeOf(wrapperT).Elem())
|
||||
wp.Field(0).Set(proxy)
|
||||
return wp.Interface()
|
||||
}
|
@ -33,7 +33,7 @@ type heightHandler struct {
|
||||
revert RevertHandler
|
||||
}
|
||||
|
||||
type eventAPI interface {
|
||||
type EventAPI interface {
|
||||
ChainNotify(context.Context) (<-chan []*api.HeadChange, error)
|
||||
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
|
||||
ChainGetTipSetByHeight(context.Context, abi.ChainEpoch, types.TipSetKey) (*types.TipSet, error)
|
||||
@ -45,7 +45,7 @@ type eventAPI interface {
|
||||
}
|
||||
|
||||
type Events struct {
|
||||
api eventAPI
|
||||
api EventAPI
|
||||
|
||||
tsc *tipSetCache
|
||||
lk sync.Mutex
|
||||
@ -59,7 +59,7 @@ type Events struct {
|
||||
observers []TipSetObserver
|
||||
}
|
||||
|
||||
func NewEventsWithConfidence(ctx context.Context, api eventAPI, gcConfidence abi.ChainEpoch) *Events {
|
||||
func NewEventsWithConfidence(ctx context.Context, api EventAPI, gcConfidence abi.ChainEpoch) *Events {
|
||||
tsc := newTSCache(gcConfidence, api)
|
||||
|
||||
e := &Events{
|
||||
@ -93,7 +93,7 @@ func NewEventsWithConfidence(ctx context.Context, api eventAPI, gcConfidence abi
|
||||
return e
|
||||
}
|
||||
|
||||
func NewEvents(ctx context.Context, api eventAPI) *Events {
|
||||
func NewEvents(ctx context.Context, api EventAPI) *Events {
|
||||
gcConfidence := 2 * build.ForkLengthThreshold
|
||||
return NewEventsWithConfidence(ctx, api, gcConfidence)
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ type queuedEvent struct {
|
||||
// Manages chain head change events, which may be forward (new tipset added to
|
||||
// chain) or backward (chain branch discarded in favour of heavier branch)
|
||||
type hcEvents struct {
|
||||
cs eventAPI
|
||||
cs EventAPI
|
||||
tsc *tipSetCache
|
||||
ctx context.Context
|
||||
gcConfidence uint64
|
||||
@ -93,7 +93,7 @@ type hcEvents struct {
|
||||
watcherEvents
|
||||
}
|
||||
|
||||
func newHCEvents(ctx context.Context, cs eventAPI, tsc *tipSetCache, gcConfidence uint64) *hcEvents {
|
||||
func newHCEvents(ctx context.Context, cs EventAPI, tsc *tipSetCache, gcConfidence uint64) *hcEvents {
|
||||
e := hcEvents{
|
||||
ctx: ctx,
|
||||
cs: cs,
|
||||
@ -353,14 +353,14 @@ type headChangeAPI interface {
|
||||
// watcherEvents watches for a state change
|
||||
type watcherEvents struct {
|
||||
ctx context.Context
|
||||
cs eventAPI
|
||||
cs EventAPI
|
||||
hcAPI headChangeAPI
|
||||
|
||||
lk sync.RWMutex
|
||||
matchers map[triggerID]StateMatchFunc
|
||||
}
|
||||
|
||||
func newWatcherEvents(ctx context.Context, hcAPI headChangeAPI, cs eventAPI) watcherEvents {
|
||||
func newWatcherEvents(ctx context.Context, hcAPI headChangeAPI, cs EventAPI) watcherEvents {
|
||||
return watcherEvents{
|
||||
ctx: ctx,
|
||||
cs: cs,
|
||||
@ -455,14 +455,14 @@ func (we *watcherEvents) StateChanged(check CheckFunc, scHnd StateChangeHandler,
|
||||
// messageEvents watches for message calls to actors
|
||||
type messageEvents struct {
|
||||
ctx context.Context
|
||||
cs eventAPI
|
||||
cs EventAPI
|
||||
hcAPI headChangeAPI
|
||||
|
||||
lk sync.RWMutex
|
||||
matchers map[triggerID]MsgMatchFunc
|
||||
}
|
||||
|
||||
func newMessageEvents(ctx context.Context, hcAPI headChangeAPI, cs eventAPI) messageEvents {
|
||||
func newMessageEvents(ctx context.Context, hcAPI headChangeAPI, cs EventAPI) messageEvents {
|
||||
return messageEvents{
|
||||
ctx: ctx,
|
||||
cs: cs,
|
||||
|
@ -229,7 +229,7 @@ func (fcs *fakeCS) notifDone() {
|
||||
fcs.sync.Unlock()
|
||||
}
|
||||
|
||||
var _ eventAPI = &fakeCS{}
|
||||
var _ EventAPI = &fakeCS{}
|
||||
|
||||
func TestAt(t *testing.T) {
|
||||
fcs := &fakeCS{
|
||||
|
@ -36,7 +36,7 @@ type FundManagerAPI struct {
|
||||
type fundManagerAPI interface {
|
||||
MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
|
||||
StateMarketBalance(context.Context, address.Address, types.TipSetKey) (api.MarketBalance, error)
|
||||
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64) (*api.MsgLookup, error)
|
||||
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
|
||||
}
|
||||
|
||||
// FundManager keeps track of funds in a set of addresses
|
||||
@ -721,6 +721,6 @@ func (env *fundManagerEnvironment) WithdrawFunds(
|
||||
}
|
||||
|
||||
func (env *fundManagerEnvironment) WaitMsg(ctx context.Context, c cid.Cid) error {
|
||||
_, err := env.api.StateWaitMsg(ctx, c, build.MessageConfidence)
|
||||
_, err := env.api.StateWaitMsg(ctx, c, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
return err
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
)
|
||||
|
||||
const LookbackNoLimit = abi.ChainEpoch(-1)
|
||||
const LookbackNoLimit = api.LookbackNoLimit
|
||||
const ReceiptAmtBitwidth = 3
|
||||
|
||||
var log = logging.Logger("statemgr")
|
||||
|
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@ -12,7 +13,6 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
ledgerfil "github.com/whyrusleeping/ledger-filecoin-go"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
ledgerwallet "github.com/filecoin-project/lotus/chain/wallet/ledger"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
@ -42,7 +42,7 @@ var ledgerListAddressesCmd = &cli.Command{
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
var api api.FullNode
|
||||
var api v0api.FullNode
|
||||
if cctx.Bool("print-balances") {
|
||||
a, closer, err := lcli.GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
|
@ -37,6 +37,7 @@ import (
|
||||
power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
|
||||
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
@ -269,7 +270,7 @@ var initCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
func migratePreSealMeta(ctx context.Context, api lapi.FullNode, metadata string, maddr address.Address, mds dtypes.MetadataDS) error {
|
||||
func migratePreSealMeta(ctx context.Context, api v0api.FullNode, metadata string, maddr address.Address, mds dtypes.MetadataDS) error {
|
||||
metadata, err := homedir.Expand(metadata)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("expanding preseal dir: %w", err)
|
||||
@ -379,7 +380,7 @@ func migratePreSealMeta(ctx context.Context, api lapi.FullNode, metadata string,
|
||||
return mds.Put(datastore.NewKey(modules.StorageCounterDSPrefix), buf[:size])
|
||||
}
|
||||
|
||||
func findMarketDealID(ctx context.Context, api lapi.FullNode, deal market2.DealProposal) (abi.DealID, error) {
|
||||
func findMarketDealID(ctx context.Context, api v0api.FullNode, deal market2.DealProposal) (abi.DealID, error) {
|
||||
// TODO: find a better way
|
||||
// (this is only used by genesis miners)
|
||||
|
||||
@ -398,7 +399,7 @@ func findMarketDealID(ctx context.Context, api lapi.FullNode, deal market2.DealP
|
||||
return 0, xerrors.New("deal not found")
|
||||
}
|
||||
|
||||
func storageMinerInit(ctx context.Context, cctx *cli.Context, api lapi.FullNode, r repo.Repo, ssize abi.SectorSize, gasPrice types.BigInt) error {
|
||||
func storageMinerInit(ctx context.Context, cctx *cli.Context, api v0api.FullNode, r repo.Repo, ssize abi.SectorSize, gasPrice types.BigInt) error {
|
||||
lr, err := r.Lock(repo.StorageMiner)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -562,7 +563,7 @@ func makeHostKey(lr repo.LockedRepo) (crypto.PrivKey, error) {
|
||||
return pk, nil
|
||||
}
|
||||
|
||||
func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.Address, peerid peer.ID, gasPrice types.BigInt) error {
|
||||
func configureStorageMiner(ctx context.Context, api v0api.FullNode, addr address.Address, peerid peer.ID, gasPrice types.BigInt) error {
|
||||
mi, err := api.StateMinerInfo(ctx, addr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getWorkerAddr returned bad address: %w", err)
|
||||
@ -600,7 +601,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.
|
||||
return nil
|
||||
}
|
||||
|
||||
func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID, gasPrice types.BigInt, cctx *cli.Context) (address.Address, error) {
|
||||
func createStorageMiner(ctx context.Context, api v0api.FullNode, peerid peer.ID, gasPrice types.BigInt, cctx *cli.Context) (address.Address, error) {
|
||||
var err error
|
||||
var owner address.Address
|
||||
if cctx.String("owner") != "" {
|
||||
|
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"net"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
@ -133,7 +134,7 @@ var runCmd = &cli.Command{
|
||||
node.Override(new(dtypes.APIEndpoint), func() (dtypes.APIEndpoint, error) {
|
||||
return multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/" + cctx.String("miner-api"))
|
||||
})),
|
||||
node.Override(new(api.FullNode), nodeApi),
|
||||
node.Override(new(v0api.FullNode), nodeApi),
|
||||
)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("creating node: %w", err)
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -668,7 +669,7 @@ var storageCleanupCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
func cleanupRemovedSectorData(ctx context.Context, api api.StorageMiner, napi api.FullNode) error {
|
||||
func cleanupRemovedSectorData(ctx context.Context, api api.StorageMiner, napi v0api.FullNode) error {
|
||||
sectors, err := api.SectorsList(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/multisig"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
@ -30,8 +31,8 @@ import (
|
||||
type InteractiveWallet struct {
|
||||
lk sync.Mutex
|
||||
|
||||
apiGetter func() (api.FullNode, jsonrpc.ClientCloser, error)
|
||||
under api.Wallet
|
||||
apiGetter func() (v0api.FullNode, jsonrpc.ClientCloser, error)
|
||||
under v0api.Wallet
|
||||
}
|
||||
|
||||
func (c *InteractiveWallet) WalletNew(ctx context.Context, typ types.KeyType) (address.Address, error) {
|
||||
|
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -149,10 +150,10 @@ var runCmd = &cli.Command{
|
||||
log.Info("Setting up API endpoint at " + address)
|
||||
|
||||
if cctx.Bool("interactive") {
|
||||
var ag func() (api.FullNode, jsonrpc.ClientCloser, error)
|
||||
var ag func() (v0api.FullNode, jsonrpc.ClientCloser, error)
|
||||
|
||||
if !cctx.Bool("offline") {
|
||||
ag = func() (api.FullNode, jsonrpc.ClientCloser, error) {
|
||||
ag = func() (v0api.FullNode, jsonrpc.ClientCloser, error) {
|
||||
return lcli.GetFullNodeAPI(cctx)
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"github.com/ipfs/go-cid"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
|
||||
@ -26,12 +26,12 @@ var log = logging.Logger("retrievaladapter")
|
||||
type retrievalProviderNode struct {
|
||||
miner *storage.Miner
|
||||
sealer sectorstorage.SectorManager
|
||||
full api.FullNode
|
||||
full v0api.FullNode
|
||||
}
|
||||
|
||||
// NewRetrievalProviderNode returns a new node adapter for a retrieval provider that talks to the
|
||||
// Lotus Node
|
||||
func NewRetrievalProviderNode(miner *storage.Miner, sealer sectorstorage.SectorManager, full api.FullNode) retrievalmarket.RetrievalProviderNode {
|
||||
func NewRetrievalProviderNode(miner *storage.Miner, sealer sectorstorage.SectorManager, full v0api.FullNode) retrievalmarket.RetrievalProviderNode {
|
||||
return &retrievalProviderNode{miner, sealer, full}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,9 @@ package storageadapter
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/api/v1api"
|
||||
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"go.uber.org/fx"
|
||||
@ -54,7 +57,7 @@ func NewClientNodeAdapter(mctx helpers.MetricsCtx, lc fx.Lifecycle, stateapi ful
|
||||
capi := &clientApi{chain, stateapi, mpool}
|
||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||
|
||||
ev := events.NewEvents(ctx, capi)
|
||||
ev := events.NewEvents(ctx, api.Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), capi).(events.EventAPI))
|
||||
a := &ClientNodeAdapter{
|
||||
clientApi: capi,
|
||||
|
||||
@ -62,7 +65,7 @@ func NewClientNodeAdapter(mctx helpers.MetricsCtx, lc fx.Lifecycle, stateapi ful
|
||||
ev: ev,
|
||||
dsMatcher: newDealStateMatcher(state.NewStatePredicates(state.WrapFastAPI(capi))),
|
||||
}
|
||||
a.scMgr = NewSectorCommittedManager(ev, a, &apiWrapper{api: capi})
|
||||
a.scMgr = NewSectorCommittedManager(ev, api.Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), a).(sealing.CurrentDealInfoTskAPI), &apiWrapper{api: capi})
|
||||
return a
|
||||
}
|
||||
|
||||
@ -196,7 +199,7 @@ func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal stor
|
||||
}
|
||||
|
||||
// TODO: timeout
|
||||
ret, err := c.StateWaitMsg(ctx, *deal.PublishMessage, build.MessageConfidence)
|
||||
ret, err := c.StateWaitMsg(ctx, *deal.PublishMessage, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return 0, xerrors.Errorf("waiting for deal publish message: %w", err)
|
||||
}
|
||||
@ -363,7 +366,7 @@ func (c *ClientNodeAdapter) GetChainHead(ctx context.Context) (shared.TipSetToke
|
||||
}
|
||||
|
||||
func (c *ClientNodeAdapter) WaitForMessage(ctx context.Context, mcid cid.Cid, cb func(code exitcode.ExitCode, bytes []byte, finalCid cid.Cid, err error) error) error {
|
||||
receipt, err := c.StateWaitMsg(ctx, mcid, build.MessageConfidence)
|
||||
receipt, err := c.StateWaitMsg(ctx, mcid, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return cb(0, nil, cid.Undef, err)
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
@ -42,7 +43,7 @@ var defaultMaxProviderCollateralMultiplier = uint64(2)
|
||||
var log = logging.Logger("storageadapter")
|
||||
|
||||
type ProviderNodeAdapter struct {
|
||||
api.FullNode
|
||||
v0api.FullNode
|
||||
|
||||
// this goes away with the data transfer module
|
||||
dag dtypes.StagingDAG
|
||||
@ -58,8 +59,8 @@ type ProviderNodeAdapter struct {
|
||||
scMgr *SectorCommittedManager
|
||||
}
|
||||
|
||||
func NewProviderNodeAdapter(fc *config.MinerFeeConfig, dc *config.DealmakingConfig) func(mctx helpers.MetricsCtx, lc fx.Lifecycle, dag dtypes.StagingDAG, secb *sectorblocks.SectorBlocks, full api.FullNode, dealPublisher *DealPublisher) storagemarket.StorageProviderNode {
|
||||
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, dag dtypes.StagingDAG, secb *sectorblocks.SectorBlocks, full api.FullNode, dealPublisher *DealPublisher) storagemarket.StorageProviderNode {
|
||||
func NewProviderNodeAdapter(fc *config.MinerFeeConfig, dc *config.DealmakingConfig) func(mctx helpers.MetricsCtx, lc fx.Lifecycle, dag dtypes.StagingDAG, secb *sectorblocks.SectorBlocks, full v0api.FullNode, dealPublisher *DealPublisher) storagemarket.StorageProviderNode {
|
||||
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, dag dtypes.StagingDAG, secb *sectorblocks.SectorBlocks, full v0api.FullNode, dealPublisher *DealPublisher) storagemarket.StorageProviderNode {
|
||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||
|
||||
ev := events.NewEvents(ctx, full)
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -56,7 +57,7 @@ func randTimeOffset(width time.Duration) time.Duration {
|
||||
|
||||
// NewMiner instantiates a miner with a concrete WinningPoStProver and a miner
|
||||
// address (which can be different from the worker's address).
|
||||
func NewMiner(api api.FullNode, epp gen.WinningPoStProver, addr address.Address, sf *slashfilter.SlashFilter, j journal.Journal) *Miner {
|
||||
func NewMiner(api v0api.FullNode, epp gen.WinningPoStProver, addr address.Address, sf *slashfilter.SlashFilter, j journal.Journal) *Miner {
|
||||
arc, err := lru.NewARC(10000)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -100,7 +101,7 @@ func NewMiner(api api.FullNode, epp gen.WinningPoStProver, addr address.Address,
|
||||
//
|
||||
// Refer to the godocs on mineOne and mine methods for more detail.
|
||||
type Miner struct {
|
||||
api api.FullNode
|
||||
api v0api.FullNode
|
||||
|
||||
epp gen.WinningPoStProver
|
||||
|
||||
|
@ -2,13 +2,13 @@ package miner
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
|
||||
lru "github.com/hashicorp/golang-lru"
|
||||
ds "github.com/ipfs/go-datastore"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/gen/slashfilter"
|
||||
"github.com/filecoin-project/lotus/journal"
|
||||
@ -19,8 +19,8 @@ type MineReq struct {
|
||||
Done func(bool, abi.ChainEpoch, error)
|
||||
}
|
||||
|
||||
func NewTestMiner(nextCh <-chan MineReq, addr address.Address) func(api.FullNode, gen.WinningPoStProver) *Miner {
|
||||
return func(api api.FullNode, epp gen.WinningPoStProver) *Miner {
|
||||
func NewTestMiner(nextCh <-chan MineReq, addr address.Address) func(v0api.FullNode, gen.WinningPoStProver) *Miner {
|
||||
return func(api v0api.FullNode, epp gen.WinningPoStProver) *Miner {
|
||||
arc, err := lru.NewARC(10000)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -55,7 +55,7 @@ import (
|
||||
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
||||
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
|
||||
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
@ -116,14 +116,14 @@ func MinerID(ma dtypes.MinerAddress) (dtypes.MinerID, error) {
|
||||
return dtypes.MinerID(id), err
|
||||
}
|
||||
|
||||
func StorageNetworkName(ctx helpers.MetricsCtx, a lapi.FullNode) (dtypes.NetworkName, error) {
|
||||
func StorageNetworkName(ctx helpers.MetricsCtx, a v0api.FullNode) (dtypes.NetworkName, error) {
|
||||
if !build.Devnet {
|
||||
return "testnetnet", nil
|
||||
}
|
||||
return a.StateNetworkName(ctx)
|
||||
}
|
||||
|
||||
func SealProofType(maddr dtypes.MinerAddress, fnapi lapi.FullNode) (abi.RegisteredSealProof, error) {
|
||||
func SealProofType(maddr dtypes.MinerAddress, fnapi v0api.FullNode) (abi.RegisteredSealProof, error) {
|
||||
mi, err := fnapi.StateMinerInfo(context.TODO(), address.Address(maddr), types.EmptyTSK)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@ -196,7 +196,7 @@ type StorageMinerParams struct {
|
||||
|
||||
Lifecycle fx.Lifecycle
|
||||
MetricsCtx helpers.MetricsCtx
|
||||
API lapi.FullNode
|
||||
API v0api.FullNode
|
||||
Host host.Host
|
||||
MetadataDS dtypes.MetadataDS
|
||||
Sealer sectorstorage.SectorManager
|
||||
@ -437,7 +437,7 @@ func StagingGraphsync(mctx helpers.MetricsCtx, lc fx.Lifecycle, ibs dtypes.Stagi
|
||||
return gs
|
||||
}
|
||||
|
||||
func SetupBlockProducer(lc fx.Lifecycle, ds dtypes.MetadataDS, api lapi.FullNode, epp gen.WinningPoStProver, sf *slashfilter.SlashFilter, j journal.Journal) (*lotusminer.Miner, error) {
|
||||
func SetupBlockProducer(lc fx.Lifecycle, ds dtypes.MetadataDS, api v0api.FullNode, epp gen.WinningPoStProver, sf *slashfilter.SlashFilter, j journal.Journal) (*lotusminer.Miner, error) {
|
||||
minerAddr, err := minerAddrFromDS(ds)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -460,7 +460,7 @@ func SetupBlockProducer(lc fx.Lifecycle, ds dtypes.MetadataDS, api lapi.FullNode
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func NewStorageAsk(ctx helpers.MetricsCtx, fapi lapi.FullNode, ds dtypes.MetadataDS, minerAddress dtypes.MinerAddress, spn storagemarket.StorageProviderNode) (*storedask.StoredAsk, error) {
|
||||
func NewStorageAsk(ctx helpers.MetricsCtx, fapi v0api.FullNode, ds dtypes.MetadataDS, minerAddress dtypes.MinerAddress, spn storagemarket.StorageProviderNode) (*storedask.StoredAsk, error) {
|
||||
|
||||
mi, err := fapi.StateMinerInfo(ctx, address.Address(minerAddress), types.EmptyTSK)
|
||||
if err != nil {
|
||||
@ -635,7 +635,7 @@ func RetrievalDealFilter(userFilter dtypes.RetrievalDealFilter) func(onlineOk dt
|
||||
func RetrievalProvider(h host.Host,
|
||||
miner *storage.Miner,
|
||||
sealer sectorstorage.SectorManager,
|
||||
full lapi.FullNode,
|
||||
full v0api.FullNode,
|
||||
ds dtypes.MetadataDS,
|
||||
pieceStore dtypes.ProviderPieceStore,
|
||||
mds dtypes.StagingMultiDstore,
|
||||
@ -678,7 +678,7 @@ func SectorStorage(mctx helpers.MetricsCtx, lc fx.Lifecycle, ls stores.LocalStor
|
||||
return sst, nil
|
||||
}
|
||||
|
||||
func StorageAuth(ctx helpers.MetricsCtx, ca lapi.Common) (sectorstorage.StorageAuth, error) {
|
||||
func StorageAuth(ctx helpers.MetricsCtx, ca v0api.Common) (sectorstorage.StorageAuth, error) {
|
||||
token, err := ca.AuthNew(ctx, []auth.Permission{"admin"})
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("creating storage auth header: %w", err)
|
||||
|
@ -2,6 +2,8 @@ package settler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/api/v1api"
|
||||
"sync"
|
||||
|
||||
"github.com/filecoin-project/lotus/paychmgr"
|
||||
@ -51,12 +53,12 @@ type paymentChannelSettler struct {
|
||||
|
||||
// SettlePaymentChannels checks the chain for events related to payment channels settling and
|
||||
// submits any vouchers for inbound channels tracked for this node
|
||||
func SettlePaymentChannels(mctx helpers.MetricsCtx, lc fx.Lifecycle, api API) error {
|
||||
func SettlePaymentChannels(mctx helpers.MetricsCtx, lc fx.Lifecycle, papi API) error {
|
||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||
lc.Append(fx.Hook{
|
||||
OnStart: func(context.Context) error {
|
||||
pcs := newPaymentChannelSettler(ctx, &api)
|
||||
ev := events.NewEvents(ctx, &api)
|
||||
pcs := newPaymentChannelSettler(ctx, &papi)
|
||||
ev := events.NewEvents(ctx, api.Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), &papi).(events.EventAPI))
|
||||
return ev.Called(pcs.check, pcs.messageHandler, pcs.revertHandler, int(build.MessageConfidence+1), events.NoTimeout, pcs.matcher)
|
||||
},
|
||||
})
|
||||
@ -93,7 +95,7 @@ func (pcs *paymentChannelSettler) messageHandler(msg *types.Message, rec *types.
|
||||
}
|
||||
go func(voucher *paych.SignedVoucher, submitMessageCID cid.Cid) {
|
||||
defer wg.Done()
|
||||
msgLookup, err := pcs.api.StateWaitMsg(pcs.ctx, submitMessageCID, build.MessageConfidence)
|
||||
msgLookup, err := pcs.api.StateWaitMsg(pcs.ctx, submitMessageCID, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
log.Errorf("submitting voucher: %s", err.Error())
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package storage
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
@ -215,7 +216,7 @@ type StorageWpp struct {
|
||||
winnRpt abi.RegisteredPoStProof
|
||||
}
|
||||
|
||||
func NewWinningPoStProver(api api.FullNode, prover storage.Prover, verifier ffiwrapper.Verifier, miner dtypes.MinerID) (*StorageWpp, error) {
|
||||
func NewWinningPoStProver(api v0api.FullNode, prover storage.Prover, verifier ffiwrapper.Verifier, miner dtypes.MinerID) (*StorageWpp, error) {
|
||||
ma, err := address.NewIDAddress(uint64(miner))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user