Propagate StateMsg api changes
This commit is contained in:
parent
d8bff4d19f
commit
81bd27911f
@ -8,6 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/v1api"
|
||||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TestNode struct {
|
type TestNode struct {
|
||||||
api.FullNode
|
v1api.FullNode
|
||||||
// ListenAddr is the address on which an API server is listening, if an
|
// ListenAddr is the address on which an API server is listening, if an
|
||||||
// API server is created for this Node
|
// API server is created for this Node
|
||||||
ListenAddr multiaddr.Multiaddr
|
ListenAddr multiaddr.Multiaddr
|
||||||
|
19
api/wrap.go
19
api/wrap.go
@ -1,21 +1,32 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import "reflect"
|
import (
|
||||||
|
"reflect"
|
||||||
|
)
|
||||||
|
|
||||||
// Wrap adapts partial api impl to another version
|
// Wrap adapts partial api impl to another version
|
||||||
// proxyT is the proxy type used as input in wrapperT
|
// proxyT is the proxy type used as input in wrapperT
|
||||||
// Usage: Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), eventsApi).(EventAPI)
|
// Usage: Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), eventsApi).(EventAPI)
|
||||||
func Wrap(proxyT, wrapperT, impl interface{}) interface{} {
|
func Wrap(proxyT, wrapperT, impl interface{}) interface{} {
|
||||||
proxy := reflect.New(reflect.TypeOf(proxyT).Elem())
|
proxy := reflect.New(reflect.TypeOf(proxyT).Elem())
|
||||||
proxyMethods := proxy.FieldByName("Internal")
|
proxyMethods := proxy.Elem().FieldByName("Internal")
|
||||||
ri := reflect.ValueOf(impl)
|
ri := reflect.ValueOf(impl)
|
||||||
|
|
||||||
for i := 0; i < ri.NumMethod(); i++ {
|
for i := 0; i < ri.NumMethod(); i++ {
|
||||||
mt := ri.Type().Method(i)
|
mt := ri.Type().Method(i)
|
||||||
proxyMethods.FieldByName(mt.Name).Set(ri.Method(i))
|
if proxyMethods.FieldByName(mt.Name).IsZero() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
fn := ri.Method(i)
|
||||||
|
of := proxyMethods.FieldByName(mt.Name)
|
||||||
|
|
||||||
|
proxyMethods.FieldByName(mt.Name).Set(reflect.MakeFunc(of.Type(), func(args []reflect.Value) (results []reflect.Value) {
|
||||||
|
return fn.Call(args)
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
wp := reflect.New(reflect.TypeOf(wrapperT).Elem())
|
wp := reflect.New(reflect.TypeOf(wrapperT).Elem())
|
||||||
wp.Field(0).Set(proxy)
|
wp.Elem().Field(0).Set(proxy)
|
||||||
return wp.Interface()
|
return wp.Interface()
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ type EventAPI interface {
|
|||||||
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
|
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
|
||||||
ChainGetTipSetByHeight(context.Context, abi.ChainEpoch, types.TipSetKey) (*types.TipSet, error)
|
ChainGetTipSetByHeight(context.Context, abi.ChainEpoch, types.TipSetKey) (*types.TipSet, error)
|
||||||
ChainHead(context.Context) (*types.TipSet, error)
|
ChainHead(context.Context) (*types.TipSet, error)
|
||||||
StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error)
|
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
|
||||||
ChainGetTipSet(context.Context, types.TipSetKey) (*types.TipSet, error)
|
ChainGetTipSet(context.Context, types.TipSetKey) (*types.TipSet, error)
|
||||||
|
|
||||||
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) // optional / for CalledMsg
|
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) // optional / for CalledMsg
|
||||||
|
@ -5,6 +5,8 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
@ -583,12 +585,16 @@ func (me *messageEvents) Called(check CheckFunc, msgHnd MsgHandler, rev RevertHa
|
|||||||
panic("expected msg")
|
panic("expected msg")
|
||||||
}
|
}
|
||||||
|
|
||||||
rec, err := me.cs.StateGetReceipt(me.ctx, msg.Cid(), ts.Key())
|
ml, err := me.cs.StateSearchMsg(me.ctx, ts.Key(), msg.Cid(), stmgr.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return msgHnd(msg, rec, ts, height)
|
if ml == nil {
|
||||||
|
return msgHnd(msg, nil, ts, height)
|
||||||
|
}
|
||||||
|
|
||||||
|
return msgHnd(msg, &ml.Receipt, ts, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
id, err := me.hcAPI.onHeadChanged(check, hnd, rev, confidence, timeout)
|
id, err := me.hcAPI.onHeadChanged(check, hnd, rev, confidence, timeout)
|
||||||
|
@ -54,7 +54,7 @@ func (fcs *fakeCS) ChainGetTipSet(ctx context.Context, key types.TipSetKey) (*ty
|
|||||||
return fcs.tipsets[key], nil
|
return fcs.tipsets[key], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fcs *fakeCS) StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error) {
|
func (fcs *fakeCS) StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ package events
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
@ -22,12 +24,16 @@ func (me *messageEvents) CheckMsg(ctx context.Context, smsg types.ChainMsg, hnd
|
|||||||
return false, true, nil
|
return false, true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
rec, err := me.cs.StateGetReceipt(ctx, smsg.VMMessage().Cid(), ts.Key())
|
ml, err := me.cs.StateSearchMsg(me.ctx, ts.Key(), msg.Cid(), stmgr.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, true, xerrors.Errorf("getting receipt in CheckMsg: %w", err)
|
return false, true, xerrors.Errorf("getting receipt in CheckMsg: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
more, err = hnd(msg, rec, ts, ts.Height())
|
if ml == nil {
|
||||||
|
more, err = hnd(msg, nil, ts, ts.Height())
|
||||||
|
} else {
|
||||||
|
more, err = hnd(msg, &ml.Receipt, ts, ts.Height())
|
||||||
|
}
|
||||||
|
|
||||||
return true, more, err
|
return true, more, err
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,11 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/go-state-types/crypto"
|
"github.com/filecoin-project/go-state-types/crypto"
|
||||||
|
@ -38,6 +38,7 @@ import (
|
|||||||
|
|
||||||
lapi "github.com/filecoin-project/lotus/api"
|
lapi "github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
|
"github.com/filecoin-project/lotus/api/v1api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
@ -150,7 +151,7 @@ var initCmd = &cli.Command{
|
|||||||
|
|
||||||
log.Info("Trying to connect to full node RPC")
|
log.Info("Trying to connect to full node RPC")
|
||||||
|
|
||||||
api, closer, err := lcli.GetFullNodeAPI(cctx) // TODO: consider storing full node address in config
|
api, closer, err := lcli.GetFullNodeAPIV1(cctx) // TODO: consider storing full node address in config
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -159,7 +160,7 @@ var initCmd = &cli.Command{
|
|||||||
log.Info("Checking full node sync status")
|
log.Info("Checking full node sync status")
|
||||||
|
|
||||||
if !cctx.Bool("genesis-miner") && !cctx.Bool("nosync") {
|
if !cctx.Bool("genesis-miner") && !cctx.Bool("nosync") {
|
||||||
if err := lcli.SyncWait(ctx, api, false); err != nil {
|
if err := lcli.SyncWait(ctx, &v0api.WrapperV1Full{FullNode: api}, false); err != nil {
|
||||||
return xerrors.Errorf("sync wait: %w", err)
|
return xerrors.Errorf("sync wait: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +271,7 @@ var initCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func migratePreSealMeta(ctx context.Context, api v0api.FullNode, metadata string, maddr address.Address, mds dtypes.MetadataDS) error {
|
func migratePreSealMeta(ctx context.Context, api v1api.FullNode, metadata string, maddr address.Address, mds dtypes.MetadataDS) error {
|
||||||
metadata, err := homedir.Expand(metadata)
|
metadata, err := homedir.Expand(metadata)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("expanding preseal dir: %w", err)
|
return xerrors.Errorf("expanding preseal dir: %w", err)
|
||||||
@ -380,7 +381,7 @@ func migratePreSealMeta(ctx context.Context, api v0api.FullNode, metadata string
|
|||||||
return mds.Put(datastore.NewKey(modules.StorageCounterDSPrefix), buf[:size])
|
return mds.Put(datastore.NewKey(modules.StorageCounterDSPrefix), buf[:size])
|
||||||
}
|
}
|
||||||
|
|
||||||
func findMarketDealID(ctx context.Context, api v0api.FullNode, deal market2.DealProposal) (abi.DealID, error) {
|
func findMarketDealID(ctx context.Context, api v1api.FullNode, deal market2.DealProposal) (abi.DealID, error) {
|
||||||
// TODO: find a better way
|
// TODO: find a better way
|
||||||
// (this is only used by genesis miners)
|
// (this is only used by genesis miners)
|
||||||
|
|
||||||
@ -399,7 +400,7 @@ func findMarketDealID(ctx context.Context, api v0api.FullNode, deal market2.Deal
|
|||||||
return 0, xerrors.New("deal not found")
|
return 0, xerrors.New("deal not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
func storageMinerInit(ctx context.Context, cctx *cli.Context, api v0api.FullNode, r repo.Repo, ssize abi.SectorSize, gasPrice types.BigInt) error {
|
func storageMinerInit(ctx context.Context, cctx *cli.Context, api v1api.FullNode, r repo.Repo, ssize abi.SectorSize, gasPrice types.BigInt) error {
|
||||||
lr, err := r.Lock(repo.StorageMiner)
|
lr, err := r.Lock(repo.StorageMiner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -563,7 +564,7 @@ func makeHostKey(lr repo.LockedRepo) (crypto.PrivKey, error) {
|
|||||||
return pk, nil
|
return pk, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func configureStorageMiner(ctx context.Context, api v0api.FullNode, addr address.Address, peerid peer.ID, gasPrice types.BigInt) error {
|
func configureStorageMiner(ctx context.Context, api v1api.FullNode, addr address.Address, peerid peer.ID, gasPrice types.BigInt) error {
|
||||||
mi, err := api.StateMinerInfo(ctx, addr, types.EmptyTSK)
|
mi, err := api.StateMinerInfo(ctx, addr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("getWorkerAddr returned bad address: %w", err)
|
return xerrors.Errorf("getWorkerAddr returned bad address: %w", err)
|
||||||
@ -589,7 +590,7 @@ func configureStorageMiner(ctx context.Context, api v0api.FullNode, addr address
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Waiting for message: ", smsg.Cid())
|
log.Info("Waiting for message: ", smsg.Cid())
|
||||||
ret, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence)
|
ret, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence, lapi.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -601,7 +602,7 @@ func configureStorageMiner(ctx context.Context, api v0api.FullNode, addr address
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func createStorageMiner(ctx context.Context, api v0api.FullNode, peerid peer.ID, gasPrice types.BigInt, cctx *cli.Context) (address.Address, error) {
|
func createStorageMiner(ctx context.Context, api v1api.FullNode, peerid peer.ID, gasPrice types.BigInt, cctx *cli.Context) (address.Address, error) {
|
||||||
var err error
|
var err error
|
||||||
var owner address.Address
|
var owner address.Address
|
||||||
if cctx.String("owner") != "" {
|
if cctx.String("owner") != "" {
|
||||||
@ -643,7 +644,7 @@ func createStorageMiner(ctx context.Context, api v0api.FullNode, peerid peer.ID,
|
|||||||
log.Infof("Initializing worker account %s, message: %s", worker, signed.Cid())
|
log.Infof("Initializing worker account %s, message: %s", worker, signed.Cid())
|
||||||
log.Infof("Waiting for confirmation")
|
log.Infof("Waiting for confirmation")
|
||||||
|
|
||||||
mw, err := api.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence)
|
mw, err := api.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence, lapi.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return address.Undef, xerrors.Errorf("waiting for worker init: %w", err)
|
return address.Undef, xerrors.Errorf("waiting for worker init: %w", err)
|
||||||
}
|
}
|
||||||
@ -701,7 +702,7 @@ func createStorageMiner(ctx context.Context, api v0api.FullNode, peerid peer.ID,
|
|||||||
log.Infof("Pushed CreateMiner message: %s", signed.Cid())
|
log.Infof("Pushed CreateMiner message: %s", signed.Cid())
|
||||||
log.Infof("Waiting for confirmation")
|
log.Infof("Waiting for confirmation")
|
||||||
|
|
||||||
mw, err := api.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence)
|
mw, err := api.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence, lapi.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return address.Undef, xerrors.Errorf("waiting for createMiner message: %w", err)
|
return address.Undef, xerrors.Errorf("waiting for createMiner message: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
|
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/ipfs/go-datastore"
|
"github.com/ipfs/go-datastore"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
"github.com/libp2p/go-libp2p-core/peer"
|
||||||
@ -54,7 +56,7 @@ var initRestoreCmd = &cli.Command{
|
|||||||
|
|
||||||
log.Info("Trying to connect to full node RPC")
|
log.Info("Trying to connect to full node RPC")
|
||||||
|
|
||||||
api, closer, err := lcli.GetFullNodeAPI(cctx) // TODO: consider storing full node address in config
|
api, closer, err := lcli.GetFullNodeAPIV1(cctx) // TODO: consider storing full node address in config
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -74,7 +76,7 @@ var initRestoreCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !cctx.Bool("nosync") {
|
if !cctx.Bool("nosync") {
|
||||||
if err := lcli.SyncWait(ctx, api, false); err != nil {
|
if err := lcli.SyncWait(ctx, &v0api.WrapperV1Full{FullNode: api}, false); err != nil {
|
||||||
return xerrors.Errorf("sync wait: %w", err)
|
return xerrors.Errorf("sync wait: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
"github.com/filecoin-project/lotus/api/v1api"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
@ -10,6 +10,8 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
|
|
||||||
mux "github.com/gorilla/mux"
|
mux "github.com/gorilla/mux"
|
||||||
"github.com/multiformats/go-multiaddr"
|
"github.com/multiformats/go-multiaddr"
|
||||||
manet "github.com/multiformats/go-multiaddr/net"
|
manet "github.com/multiformats/go-multiaddr/net"
|
||||||
@ -64,7 +66,7 @@ var runCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeApi, ncloser, err := lcli.GetFullNodeAPI(cctx)
|
nodeApi, ncloser, err := lcli.GetFullNodeAPIV1(cctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("getting full node api: %w", err)
|
return xerrors.Errorf("getting full node api: %w", err)
|
||||||
}
|
}
|
||||||
@ -102,7 +104,7 @@ var runCmd = &cli.Command{
|
|||||||
log.Info("Checking full node sync status")
|
log.Info("Checking full node sync status")
|
||||||
|
|
||||||
if !cctx.Bool("nosync") {
|
if !cctx.Bool("nosync") {
|
||||||
if err := lcli.SyncWait(ctx, nodeApi, false); err != nil {
|
if err := lcli.SyncWait(ctx, &v0api.WrapperV1Full{FullNode: nodeApi}, false); err != nil {
|
||||||
return xerrors.Errorf("sync wait: %w", err)
|
return xerrors.Errorf("sync wait: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,7 +136,7 @@ var runCmd = &cli.Command{
|
|||||||
node.Override(new(dtypes.APIEndpoint), func() (dtypes.APIEndpoint, error) {
|
node.Override(new(dtypes.APIEndpoint), func() (dtypes.APIEndpoint, error) {
|
||||||
return multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/" + cctx.String("miner-api"))
|
return multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/" + cctx.String("miner-api"))
|
||||||
})),
|
})),
|
||||||
node.Override(new(v0api.FullNode), nodeApi),
|
node.Override(new(v1api.FullNode), nodeApi),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("creating node: %w", err)
|
return xerrors.Errorf("creating node: %w", err)
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -13,6 +12,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
|
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
@ -2,11 +2,12 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
4
extern/storage-sealing/currentdealinfo.go
vendored
4
extern/storage-sealing/currentdealinfo.go
vendored
@ -160,7 +160,7 @@ type CurrentDealInfoTskAPI interface {
|
|||||||
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)
|
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)
|
||||||
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||||
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
|
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
|
||||||
StateSearchMsg(context.Context, cid.Cid) (*api.MsgLookup, error)
|
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type CurrentDealInfoAPIAdapter struct {
|
type CurrentDealInfoAPIAdapter struct {
|
||||||
@ -186,7 +186,7 @@ func (c *CurrentDealInfoAPIAdapter) StateMarketStorageDeal(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *CurrentDealInfoAPIAdapter) StateSearchMsg(ctx context.Context, k cid.Cid) (*MsgLookup, error) {
|
func (c *CurrentDealInfoAPIAdapter) StateSearchMsg(ctx context.Context, k cid.Cid) (*MsgLookup, error) {
|
||||||
wmsg, err := c.CurrentDealInfoTskAPI.StateSearchMsg(ctx, k)
|
wmsg, err := c.CurrentDealInfoTskAPI.StateSearchMsg(ctx, types.EmptyTSK, k, api.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/v1api"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
|
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
|
||||||
@ -26,12 +27,12 @@ var log = logging.Logger("retrievaladapter")
|
|||||||
type retrievalProviderNode struct {
|
type retrievalProviderNode struct {
|
||||||
miner *storage.Miner
|
miner *storage.Miner
|
||||||
sealer sectorstorage.SectorManager
|
sealer sectorstorage.SectorManager
|
||||||
full v0api.FullNode
|
full v1api.FullNode
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRetrievalProviderNode returns a new node adapter for a retrieval provider that talks to the
|
// NewRetrievalProviderNode returns a new node adapter for a retrieval provider that talks to the
|
||||||
// Lotus Node
|
// Lotus Node
|
||||||
func NewRetrievalProviderNode(miner *storage.Miner, sealer sectorstorage.SectorManager, full v0api.FullNode) retrievalmarket.RetrievalProviderNode {
|
func NewRetrievalProviderNode(miner *storage.Miner, sealer sectorstorage.SectorManager, full v1api.FullNode) retrievalmarket.RetrievalProviderNode {
|
||||||
return &retrievalProviderNode{miner, sealer, full}
|
return &retrievalProviderNode{miner, sealer, full}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,9 +5,6 @@ package storageadapter
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"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"
|
"github.com/ipfs/go-cid"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
@ -57,7 +54,7 @@ func NewClientNodeAdapter(mctx helpers.MetricsCtx, lc fx.Lifecycle, stateapi ful
|
|||||||
capi := &clientApi{chain, stateapi, mpool}
|
capi := &clientApi{chain, stateapi, mpool}
|
||||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||||
|
|
||||||
ev := events.NewEvents(ctx, api.Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), capi).(events.EventAPI))
|
ev := events.NewEvents(ctx, capi)
|
||||||
a := &ClientNodeAdapter{
|
a := &ClientNodeAdapter{
|
||||||
clientApi: capi,
|
clientApi: capi,
|
||||||
|
|
||||||
@ -65,7 +62,7 @@ func NewClientNodeAdapter(mctx helpers.MetricsCtx, lc fx.Lifecycle, stateapi ful
|
|||||||
ev: ev,
|
ev: ev,
|
||||||
dsMatcher: newDealStateMatcher(state.NewStatePredicates(state.WrapFastAPI(capi))),
|
dsMatcher: newDealStateMatcher(state.NewStatePredicates(state.WrapFastAPI(capi))),
|
||||||
}
|
}
|
||||||
a.scMgr = NewSectorCommittedManager(ev, api.Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), a).(sealing.CurrentDealInfoTskAPI), &apiWrapper{api: capi})
|
a.scMgr = NewSectorCommittedManager(ev, a, &apiWrapper{api: capi})
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
"github.com/filecoin-project/lotus/api/v1api"
|
||||||
"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/actors/builtin/market"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
@ -43,7 +43,7 @@ var defaultMaxProviderCollateralMultiplier = uint64(2)
|
|||||||
var log = logging.Logger("storageadapter")
|
var log = logging.Logger("storageadapter")
|
||||||
|
|
||||||
type ProviderNodeAdapter struct {
|
type ProviderNodeAdapter struct {
|
||||||
v0api.FullNode
|
v1api.FullNode
|
||||||
|
|
||||||
// this goes away with the data transfer module
|
// this goes away with the data transfer module
|
||||||
dag dtypes.StagingDAG
|
dag dtypes.StagingDAG
|
||||||
@ -59,8 +59,8 @@ type ProviderNodeAdapter struct {
|
|||||||
scMgr *SectorCommittedManager
|
scMgr *SectorCommittedManager
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
func NewProviderNodeAdapter(fc *config.MinerFeeConfig, dc *config.DealmakingConfig) func(mctx helpers.MetricsCtx, lc fx.Lifecycle, dag dtypes.StagingDAG, secb *sectorblocks.SectorBlocks, full v1api.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 {
|
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, dag dtypes.StagingDAG, secb *sectorblocks.SectorBlocks, full v1api.FullNode, dealPublisher *DealPublisher) storagemarket.StorageProviderNode {
|
||||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||||
|
|
||||||
ev := events.NewEvents(ctx, full)
|
ev := events.NewEvents(ctx, full)
|
||||||
@ -291,7 +291,7 @@ func (n *ProviderNodeAdapter) GetChainHead(ctx context.Context) (shared.TipSetTo
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) WaitForMessage(ctx context.Context, mcid cid.Cid, cb func(code exitcode.ExitCode, bytes []byte, finalCid cid.Cid, err error) error) error {
|
func (n *ProviderNodeAdapter) WaitForMessage(ctx context.Context, mcid cid.Cid, cb func(code exitcode.ExitCode, bytes []byte, finalCid cid.Cid, err error) error) error {
|
||||||
receipt, err := n.StateWaitMsg(ctx, mcid, 2*build.MessageConfidence)
|
receipt, err := n.StateWaitMsg(ctx, mcid, 2*build.MessageConfidence, api.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cb(0, nil, cid.Undef, err)
|
return cb(0, nil, cid.Undef, err)
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ func (n *ProviderNodeAdapter) WaitForMessage(ctx context.Context, mcid cid.Cid,
|
|||||||
|
|
||||||
func (n *ProviderNodeAdapter) WaitForPublishDeals(ctx context.Context, publishCid cid.Cid, proposal market2.DealProposal) (*storagemarket.PublishDealsWaitResult, error) {
|
func (n *ProviderNodeAdapter) WaitForPublishDeals(ctx context.Context, publishCid cid.Cid, proposal market2.DealProposal) (*storagemarket.PublishDealsWaitResult, error) {
|
||||||
// Wait for deal to be published (plus additional time for confidence)
|
// Wait for deal to be published (plus additional time for confidence)
|
||||||
receipt, err := n.StateWaitMsg(ctx, publishCid, 2*build.MessageConfidence)
|
receipt, err := n.StateWaitMsg(ctx, publishCid, 2*build.MessageConfidence, api.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("WaitForPublishDeals errored: %w", err)
|
return nil, xerrors.Errorf("WaitForPublishDeals errored: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,11 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/v1api"
|
||||||
|
|
||||||
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
|
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/gen/slashfilter"
|
"github.com/filecoin-project/lotus/chain/gen/slashfilter"
|
||||||
@ -57,7 +58,7 @@ func randTimeOffset(width time.Duration) time.Duration {
|
|||||||
|
|
||||||
// NewMiner instantiates a miner with a concrete WinningPoStProver and a miner
|
// NewMiner instantiates a miner with a concrete WinningPoStProver and a miner
|
||||||
// address (which can be different from the worker's address).
|
// address (which can be different from the worker's address).
|
||||||
func NewMiner(api v0api.FullNode, epp gen.WinningPoStProver, addr address.Address, sf *slashfilter.SlashFilter, j journal.Journal) *Miner {
|
func NewMiner(api v1api.FullNode, epp gen.WinningPoStProver, addr address.Address, sf *slashfilter.SlashFilter, j journal.Journal) *Miner {
|
||||||
arc, err := lru.NewARC(10000)
|
arc, err := lru.NewARC(10000)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -101,7 +102,7 @@ func NewMiner(api v0api.FullNode, epp gen.WinningPoStProver, addr address.Addres
|
|||||||
//
|
//
|
||||||
// Refer to the godocs on mineOne and mine methods for more detail.
|
// Refer to the godocs on mineOne and mine methods for more detail.
|
||||||
type Miner struct {
|
type Miner struct {
|
||||||
api v0api.FullNode
|
api v1api.FullNode
|
||||||
|
|
||||||
epp gen.WinningPoStProver
|
epp gen.WinningPoStProver
|
||||||
|
|
||||||
|
@ -2,13 +2,14 @@ package miner
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
|
|
||||||
lru "github.com/hashicorp/golang-lru"
|
lru "github.com/hashicorp/golang-lru"
|
||||||
ds "github.com/ipfs/go-datastore"
|
ds "github.com/ipfs/go-datastore"
|
||||||
|
|
||||||
"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/v1api"
|
||||||
"github.com/filecoin-project/lotus/chain/gen"
|
"github.com/filecoin-project/lotus/chain/gen"
|
||||||
"github.com/filecoin-project/lotus/chain/gen/slashfilter"
|
"github.com/filecoin-project/lotus/chain/gen/slashfilter"
|
||||||
"github.com/filecoin-project/lotus/journal"
|
"github.com/filecoin-project/lotus/journal"
|
||||||
@ -19,8 +20,8 @@ type MineReq struct {
|
|||||||
Done func(bool, abi.ChainEpoch, error)
|
Done func(bool, abi.ChainEpoch, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTestMiner(nextCh <-chan MineReq, addr address.Address) func(v0api.FullNode, gen.WinningPoStProver) *Miner {
|
func NewTestMiner(nextCh <-chan MineReq, addr address.Address) func(v1api.FullNode, gen.WinningPoStProver) *Miner {
|
||||||
return func(api v0api.FullNode, epp gen.WinningPoStProver) *Miner {
|
return func(api v1api.FullNode, epp gen.WinningPoStProver) *Miner {
|
||||||
arc, err := lru.NewARC(10000)
|
arc, err := lru.NewARC(10000)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -32,6 +32,8 @@ type PaychAPI struct {
|
|||||||
full.StateAPI
|
full.StateAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ paychmgr.PaychAPI = &PaychAPI{}
|
||||||
|
|
||||||
// HandlePaychManager is called by dependency injection to set up hooks
|
// HandlePaychManager is called by dependency injection to set up hooks
|
||||||
func HandlePaychManager(lc fx.Lifecycle, pm *paychmgr.Manager) {
|
func HandlePaychManager(lc fx.Lifecycle, pm *paychmgr.Manager) {
|
||||||
lc.Append(fx.Hook{
|
lc.Append(fx.Hook{
|
||||||
|
@ -56,6 +56,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
|
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
|
"github.com/filecoin-project/lotus/api/v1api"
|
||||||
"github.com/filecoin-project/lotus/blockstore"
|
"github.com/filecoin-project/lotus/blockstore"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
@ -116,14 +117,14 @@ func MinerID(ma dtypes.MinerAddress) (dtypes.MinerID, error) {
|
|||||||
return dtypes.MinerID(id), err
|
return dtypes.MinerID(id), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func StorageNetworkName(ctx helpers.MetricsCtx, a v0api.FullNode) (dtypes.NetworkName, error) {
|
func StorageNetworkName(ctx helpers.MetricsCtx, a v1api.FullNode) (dtypes.NetworkName, error) {
|
||||||
if !build.Devnet {
|
if !build.Devnet {
|
||||||
return "testnetnet", nil
|
return "testnetnet", nil
|
||||||
}
|
}
|
||||||
return a.StateNetworkName(ctx)
|
return a.StateNetworkName(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SealProofType(maddr dtypes.MinerAddress, fnapi v0api.FullNode) (abi.RegisteredSealProof, error) {
|
func SealProofType(maddr dtypes.MinerAddress, fnapi v1api.FullNode) (abi.RegisteredSealProof, error) {
|
||||||
mi, err := fnapi.StateMinerInfo(context.TODO(), address.Address(maddr), types.EmptyTSK)
|
mi, err := fnapi.StateMinerInfo(context.TODO(), address.Address(maddr), types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
@ -196,7 +197,7 @@ type StorageMinerParams struct {
|
|||||||
|
|
||||||
Lifecycle fx.Lifecycle
|
Lifecycle fx.Lifecycle
|
||||||
MetricsCtx helpers.MetricsCtx
|
MetricsCtx helpers.MetricsCtx
|
||||||
API v0api.FullNode
|
API v1api.FullNode
|
||||||
Host host.Host
|
Host host.Host
|
||||||
MetadataDS dtypes.MetadataDS
|
MetadataDS dtypes.MetadataDS
|
||||||
Sealer sectorstorage.SectorManager
|
Sealer sectorstorage.SectorManager
|
||||||
@ -437,7 +438,7 @@ func StagingGraphsync(mctx helpers.MetricsCtx, lc fx.Lifecycle, ibs dtypes.Stagi
|
|||||||
return gs
|
return gs
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetupBlockProducer(lc fx.Lifecycle, ds dtypes.MetadataDS, api v0api.FullNode, epp gen.WinningPoStProver, sf *slashfilter.SlashFilter, j journal.Journal) (*lotusminer.Miner, error) {
|
func SetupBlockProducer(lc fx.Lifecycle, ds dtypes.MetadataDS, api v1api.FullNode, epp gen.WinningPoStProver, sf *slashfilter.SlashFilter, j journal.Journal) (*lotusminer.Miner, error) {
|
||||||
minerAddr, err := minerAddrFromDS(ds)
|
minerAddr, err := minerAddrFromDS(ds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -460,7 +461,7 @@ func SetupBlockProducer(lc fx.Lifecycle, ds dtypes.MetadataDS, api v0api.FullNod
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStorageAsk(ctx helpers.MetricsCtx, fapi v0api.FullNode, ds dtypes.MetadataDS, minerAddress dtypes.MinerAddress, spn storagemarket.StorageProviderNode) (*storedask.StoredAsk, error) {
|
func NewStorageAsk(ctx helpers.MetricsCtx, fapi v1api.FullNode, ds dtypes.MetadataDS, minerAddress dtypes.MinerAddress, spn storagemarket.StorageProviderNode) (*storedask.StoredAsk, error) {
|
||||||
|
|
||||||
mi, err := fapi.StateMinerInfo(ctx, address.Address(minerAddress), types.EmptyTSK)
|
mi, err := fapi.StateMinerInfo(ctx, address.Address(minerAddress), types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -635,7 +636,7 @@ func RetrievalDealFilter(userFilter dtypes.RetrievalDealFilter) func(onlineOk dt
|
|||||||
func RetrievalProvider(h host.Host,
|
func RetrievalProvider(h host.Host,
|
||||||
miner *storage.Miner,
|
miner *storage.Miner,
|
||||||
sealer sectorstorage.SectorManager,
|
sealer sectorstorage.SectorManager,
|
||||||
full v0api.FullNode,
|
full v1api.FullNode,
|
||||||
ds dtypes.MetadataDS,
|
ds dtypes.MetadataDS,
|
||||||
pieceStore dtypes.ProviderPieceStore,
|
pieceStore dtypes.ProviderPieceStore,
|
||||||
mds dtypes.StagingMultiDstore,
|
mds dtypes.StagingMultiDstore,
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/api/client"
|
"github.com/filecoin-project/lotus/api/client"
|
||||||
"github.com/filecoin-project/lotus/api/test"
|
"github.com/filecoin-project/lotus/api/test"
|
||||||
|
"github.com/filecoin-project/lotus/api/v1api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain"
|
"github.com/filecoin-project/lotus/chain"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
@ -122,7 +123,7 @@ func CreateTestStorageNode(ctx context.Context, t *testing.T, waddr address.Addr
|
|||||||
|
|
||||||
node.MockHost(mn),
|
node.MockHost(mn),
|
||||||
|
|
||||||
node.Override(new(api.FullNode), tnd),
|
node.Override(new(v1api.FullNode), tnd),
|
||||||
node.Override(new(*lotusminer.Miner), lotusminer.NewTestMiner(mineBlock, act)),
|
node.Override(new(*lotusminer.Miner), lotusminer.NewTestMiner(mineBlock, act)),
|
||||||
|
|
||||||
opts,
|
opts,
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
xerrors "golang.org/x/xerrors"
|
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/crypto"
|
"github.com/filecoin-project/go-state-types/crypto"
|
||||||
"github.com/filecoin-project/go-state-types/network"
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ type stateManagerAPI interface {
|
|||||||
// paychAPI defines the API methods needed by the payment channel manager
|
// paychAPI defines the API methods needed by the payment channel manager
|
||||||
type PaychAPI interface {
|
type PaychAPI interface {
|
||||||
StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||||
StateWaitMsg(ctx context.Context, msg cid.Cid, confidence uint64) (*api.MsgLookup, error)
|
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
|
||||||
MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee *api.MessageSendSpec) (*types.SignedMessage, error)
|
MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee *api.MessageSendSpec) (*types.SignedMessage, error)
|
||||||
WalletHas(ctx context.Context, addr address.Address) (bool, error)
|
WalletHas(ctx context.Context, addr address.Address) (bool, error)
|
||||||
WalletSign(ctx context.Context, k address.Address, msg []byte) (*crypto.Signature, error)
|
WalletSign(ctx context.Context, k address.Address, msg []byte) (*crypto.Signature, error)
|
||||||
|
@ -2,8 +2,6 @@ package settler
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
"github.com/filecoin-project/lotus/api/v1api"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/paychmgr"
|
"github.com/filecoin-project/lotus/paychmgr"
|
||||||
@ -58,7 +56,7 @@ func SettlePaymentChannels(mctx helpers.MetricsCtx, lc fx.Lifecycle, papi API) e
|
|||||||
lc.Append(fx.Hook{
|
lc.Append(fx.Hook{
|
||||||
OnStart: func(context.Context) error {
|
OnStart: func(context.Context) error {
|
||||||
pcs := newPaymentChannelSettler(ctx, &papi)
|
pcs := newPaymentChannelSettler(ctx, &papi)
|
||||||
ev := events.NewEvents(ctx, api.Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), &papi).(events.EventAPI))
|
ev := events.NewEvents(ctx, papi)
|
||||||
return ev.Called(pcs.check, pcs.messageHandler, pcs.revertHandler, int(build.MessageConfidence+1), events.NoTimeout, pcs.matcher)
|
return ev.Called(pcs.check, pcs.messageHandler, pcs.revertHandler, int(build.MessageConfidence+1), events.NoTimeout, pcs.matcher)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -413,7 +413,7 @@ func (ca *channelAccessor) waitForPaychCreateMsg(channelID string, mcid cid.Cid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ca *channelAccessor) waitPaychCreateMsg(channelID string, mcid cid.Cid) error {
|
func (ca *channelAccessor) waitPaychCreateMsg(channelID string, mcid cid.Cid) error {
|
||||||
mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, build.MessageConfidence)
|
mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("wait msg: %v", err)
|
log.Errorf("wait msg: %v", err)
|
||||||
return err
|
return err
|
||||||
@ -499,7 +499,7 @@ func (ca *channelAccessor) waitForAddFundsMsg(channelID string, mcid cid.Cid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ca *channelAccessor) waitAddFundsMsg(channelID string, mcid cid.Cid) error {
|
func (ca *channelAccessor) waitAddFundsMsg(channelID string, mcid cid.Cid) error {
|
||||||
mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, build.MessageConfidence)
|
mwait, err := ca.api.StateWaitMsg(ca.chctx, mcid, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return err
|
return err
|
||||||
|
@ -103,7 +103,7 @@ func (s SealingAPIAdapter) StateMinerSectorAllocated(ctx context.Context, maddr
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s SealingAPIAdapter) StateWaitMsg(ctx context.Context, mcid cid.Cid) (sealing.MsgLookup, error) {
|
func (s SealingAPIAdapter) StateWaitMsg(ctx context.Context, mcid cid.Cid) (sealing.MsgLookup, error) {
|
||||||
wmsg, err := s.delegate.StateWaitMsg(ctx, mcid, build.MessageConfidence)
|
wmsg, err := s.delegate.StateWaitMsg(ctx, mcid, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sealing.MsgLookup{}, err
|
return sealing.MsgLookup{}, err
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ func (s SealingAPIAdapter) StateWaitMsg(ctx context.Context, mcid cid.Cid) (seal
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s SealingAPIAdapter) StateSearchMsg(ctx context.Context, c cid.Cid) (*sealing.MsgLookup, error) {
|
func (s SealingAPIAdapter) StateSearchMsg(ctx context.Context, c cid.Cid) (*sealing.MsgLookup, error) {
|
||||||
wmsg, err := s.delegate.StateSearchMsg(ctx, c)
|
wmsg, err := s.delegate.StateSearchMsg(ctx, types.EmptyTSK, c, api.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package storage
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
"github.com/filecoin-project/lotus/api/v1api"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/network"
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
@ -84,10 +84,9 @@ type storageMinerApi interface {
|
|||||||
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)
|
||||||
StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (bool, error)
|
StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (bool, error)
|
||||||
StateSearchMsg(context.Context, cid.Cid) (*api.MsgLookup, error)
|
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
|
||||||
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64) (*api.MsgLookup, error) // TODO: removeme eventually
|
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
|
||||||
StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error)
|
StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error)
|
||||||
StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error)
|
|
||||||
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
|
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
|
||||||
StateMinerFaults(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error)
|
StateMinerFaults(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error)
|
||||||
StateMinerRecoveries(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error)
|
StateMinerRecoveries(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error)
|
||||||
@ -216,7 +215,7 @@ type StorageWpp struct {
|
|||||||
winnRpt abi.RegisteredPoStProof
|
winnRpt abi.RegisteredPoStProof
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWinningPoStProver(api v0api.FullNode, prover storage.Prover, verifier ffiwrapper.Verifier, miner dtypes.MinerID) (*StorageWpp, error) {
|
func NewWinningPoStProver(api v1api.FullNode, prover storage.Prover, verifier ffiwrapper.Verifier, miner dtypes.MinerID) (*StorageWpp, error) {
|
||||||
ma, err := address.NewIDAddress(uint64(miner))
|
ma, err := address.NewIDAddress(uint64(miner))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -313,7 +313,7 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, dlIdx uin
|
|||||||
|
|
||||||
log.Warnw("declare faults recovered Message CID", "cid", sm.Cid())
|
log.Warnw("declare faults recovered Message CID", "cid", sm.Cid())
|
||||||
|
|
||||||
rec, err := s.api.StateWaitMsg(context.TODO(), sm.Cid(), build.MessageConfidence)
|
rec, err := s.api.StateWaitMsg(context.TODO(), sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return recoveries, sm, xerrors.Errorf("declare faults recovered wait error: %w", err)
|
return recoveries, sm, xerrors.Errorf("declare faults recovered wait error: %w", err)
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64,
|
|||||||
|
|
||||||
log.Warnw("declare faults Message CID", "cid", sm.Cid())
|
log.Warnw("declare faults Message CID", "cid", sm.Cid())
|
||||||
|
|
||||||
rec, err := s.api.StateWaitMsg(context.TODO(), sm.Cid(), build.MessageConfidence)
|
rec, err := s.api.StateWaitMsg(context.TODO(), sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return faults, sm, xerrors.Errorf("declare faults wait error: %w", err)
|
return faults, sm, xerrors.Errorf("declare faults wait error: %w", err)
|
||||||
}
|
}
|
||||||
@ -787,7 +787,7 @@ func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.Submi
|
|||||||
log.Infof("Submitted window post: %s", sm.Cid())
|
log.Infof("Submitted window post: %s", sm.Cid())
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
rec, err := s.api.StateWaitMsg(context.TODO(), sm.Cid(), build.MessageConfidence)
|
rec, err := s.api.StateWaitMsg(context.TODO(), sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user