Fix buildall
This commit is contained in:
parent
81bd27911f
commit
eee50caaf1
7
Makefile
7
Makefile
@ -233,6 +233,13 @@ testground:
|
|||||||
.PHONY: testground
|
.PHONY: testground
|
||||||
BINS+=testground
|
BINS+=testground
|
||||||
|
|
||||||
|
|
||||||
|
tvx:
|
||||||
|
rm -f tvx
|
||||||
|
go build -o tvx ./cmd/tvx
|
||||||
|
.PHONY: tvx
|
||||||
|
BINS+=tvx
|
||||||
|
|
||||||
install-chainwatch: lotus-chainwatch
|
install-chainwatch: lotus-chainwatch
|
||||||
install -C ./lotus-chainwatch /usr/local/bin/lotus-chainwatch
|
install -C ./lotus-chainwatch /usr/local/bin/lotus-chainwatch
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/blockstore"
|
"github.com/filecoin-project/lotus/blockstore"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/power"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/power"
|
||||||
@ -1026,7 +1026,7 @@ func (p *Processor) storeMinersPower(miners []minerActorInfo) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load the power actor state clam as an adt.Map at the tipset `ts`.
|
// load the power actor state clam as an adt.Map at the tipset `ts`.
|
||||||
func getPowerActorState(ctx context.Context, api api.FullNode, ts types.TipSetKey) (power.State, error) {
|
func getPowerActorState(ctx context.Context, api v0api.FullNode, ts types.TipSetKey) (power.State, error) {
|
||||||
powerActor, err := api.StateGetActor(ctx, power.Address, ts)
|
powerActor, err := api.StateGetActor(ctx, power.Address, ts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
cw_util "github.com/filecoin-project/lotus/cmd/lotus-chainwatch/util"
|
cw_util "github.com/filecoin-project/lotus/cmd/lotus-chainwatch/util"
|
||||||
"github.com/filecoin-project/lotus/lib/parmap"
|
"github.com/filecoin-project/lotus/lib/parmap"
|
||||||
@ -28,7 +28,7 @@ var log = logging.Logger("processor")
|
|||||||
type Processor struct {
|
type Processor struct {
|
||||||
db *sql.DB
|
db *sql.DB
|
||||||
|
|
||||||
node api.FullNode
|
node v0api.FullNode
|
||||||
ctxStore *cw_util.APIIpldStore
|
ctxStore *cw_util.APIIpldStore
|
||||||
|
|
||||||
genesisTs *types.TipSet
|
genesisTs *types.TipSet
|
||||||
@ -52,7 +52,7 @@ type actorInfo struct {
|
|||||||
state string
|
state string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewProcessor(ctx context.Context, db *sql.DB, node api.FullNode, batch int) *Processor {
|
func NewProcessor(ctx context.Context, db *sql.DB, node v0api.FullNode, batch int) *Processor {
|
||||||
ctxStore := cw_util.NewAPIIpldStore(ctx, node)
|
ctxStore := cw_util.NewAPIIpldStore(ctx, node)
|
||||||
return &Processor{
|
return &Processor{
|
||||||
db: db,
|
db: db,
|
||||||
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"net/http"
|
"net/http"
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
"os"
|
"os"
|
||||||
@ -15,7 +16,6 @@ import (
|
|||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
"github.com/filecoin-project/lotus/cmd/lotus-chainwatch/processor"
|
"github.com/filecoin-project/lotus/cmd/lotus-chainwatch/processor"
|
||||||
"github.com/filecoin-project/lotus/cmd/lotus-chainwatch/scheduler"
|
"github.com/filecoin-project/lotus/cmd/lotus-chainwatch/scheduler"
|
||||||
@ -44,7 +44,7 @@ var runCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var api api.FullNode
|
var api v0api.FullNode
|
||||||
var closer jsonrpc.ClientCloser
|
var closer jsonrpc.ClientCloser
|
||||||
var err error
|
var err error
|
||||||
if tokenMaddr := cctx.String("api"); tokenMaddr != "" {
|
if tokenMaddr := cctx.String("api"); tokenMaddr != "" {
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"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"
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/chain/store"
|
"github.com/filecoin-project/lotus/chain/store"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
@ -26,10 +26,10 @@ type Syncer struct {
|
|||||||
lookbackLimit uint64
|
lookbackLimit uint64
|
||||||
|
|
||||||
headerLk sync.Mutex
|
headerLk sync.Mutex
|
||||||
node api.FullNode
|
node v0api.FullNode
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSyncer(db *sql.DB, node api.FullNode, lookbackLimit uint64) *Syncer {
|
func NewSyncer(db *sql.DB, node v0api.FullNode, lookbackLimit uint64) *Syncer {
|
||||||
return &Syncer{
|
return &Syncer{
|
||||||
db: db,
|
db: db,
|
||||||
node: node,
|
node: node,
|
||||||
|
@ -2,16 +2,16 @@ package util
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-jsonrpc"
|
"github.com/filecoin-project/go-jsonrpc"
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/api/client"
|
"github.com/filecoin-project/lotus/api/client"
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
ma "github.com/multiformats/go-multiaddr"
|
||||||
manet "github.com/multiformats/go-multiaddr/net"
|
manet "github.com/multiformats/go-multiaddr/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetFullNodeAPIUsingCredentials(ctx context.Context, listenAddr, token string) (api.FullNode, jsonrpc.ClientCloser, error) {
|
func GetFullNodeAPIUsingCredentials(ctx context.Context, listenAddr, token string) (v0api.FullNode, jsonrpc.ClientCloser, error) {
|
||||||
parsedAddr, err := ma.NewMultiaddr(listenAddr)
|
parsedAddr, err := ma.NewMultiaddr(listenAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
@ -22,7 +22,7 @@ func GetFullNodeAPIUsingCredentials(ctx context.Context, listenAddr, token strin
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return client.NewFullNodeRPCV1(ctx, apiURI(addr), apiHeaders(token))
|
return client.NewFullNodeRPCV0(ctx, apiURI(addr), apiHeaders(token))
|
||||||
}
|
}
|
||||||
func apiURI(addr string) string {
|
func apiURI(addr string) string {
|
||||||
return "ws://" + addr + "/rpc/v0"
|
return "ws://" + addr + "/rpc/v0"
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO extract this to a common location in lotus and reuse the code
|
// TODO extract this to a common location in lotus and reuse the code
|
||||||
@ -16,10 +16,10 @@ import (
|
|||||||
// APIIpldStore is required for AMT and HAMT access.
|
// APIIpldStore is required for AMT and HAMT access.
|
||||||
type APIIpldStore struct {
|
type APIIpldStore struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
api api.FullNode
|
api v0api.FullNode
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAPIIpldStore(ctx context.Context, api api.FullNode) *APIIpldStore {
|
func NewAPIIpldStore(ctx context.Context, api v0api.FullNode) *APIIpldStore {
|
||||||
return &APIIpldStore{
|
return &APIIpldStore{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
api: api,
|
api: api,
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
@ -143,7 +143,7 @@ func prepFundsHtml(box *rice.Box) http.HandlerFunc {
|
|||||||
|
|
||||||
type handler struct {
|
type handler struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
api api.FullNode
|
api v0api.FullNode
|
||||||
|
|
||||||
from address.Address
|
from address.Address
|
||||||
sendPerRequest types.FIL
|
sendPerRequest types.FIL
|
||||||
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
@ -14,7 +15,6 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-jsonrpc"
|
"github.com/filecoin-project/go-jsonrpc"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
@ -180,7 +180,7 @@ func checkWindow(window CidWindow, t int) bool {
|
|||||||
* returns a slice of slices of Cids
|
* returns a slice of slices of Cids
|
||||||
* len of slice <= `t` - threshold
|
* len of slice <= `t` - threshold
|
||||||
*/
|
*/
|
||||||
func updateWindow(ctx context.Context, a api.FullNode, w CidWindow, t int, r int, to time.Duration) (CidWindow, error) {
|
func updateWindow(ctx context.Context, a v0api.FullNode, w CidWindow, t int, r int, to time.Duration) (CidWindow, error) {
|
||||||
head, err := getHead(ctx, a, r, to)
|
head, err := getHead(ctx, a, r, to)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -194,7 +194,7 @@ func updateWindow(ctx context.Context, a api.FullNode, w CidWindow, t int, r int
|
|||||||
* retries if API no available
|
* retries if API no available
|
||||||
* returns tipset
|
* returns tipset
|
||||||
*/
|
*/
|
||||||
func getHead(ctx context.Context, a api.FullNode, r int, t time.Duration) (*types.TipSet, error) {
|
func getHead(ctx context.Context, a v0api.FullNode, r int, t time.Duration) (*types.TipSet, error) {
|
||||||
for i := 0; i < r; i++ {
|
for i := 0; i < r; i++ {
|
||||||
head, err := a.ChainHead(ctx)
|
head, err := a.ChainHead(ctx)
|
||||||
if err != nil && i == (r-1) {
|
if err != nil && i == (r-1) {
|
||||||
@ -226,7 +226,7 @@ func appendCIDsToWindow(w CidWindow, c []cid.Cid, t int) CidWindow {
|
|||||||
/*
|
/*
|
||||||
* wait for node to sync
|
* wait for node to sync
|
||||||
*/
|
*/
|
||||||
func waitForSyncComplete(ctx context.Context, a api.FullNode, r int, t time.Duration) error {
|
func waitForSyncComplete(ctx context.Context, a v0api.FullNode, r int, t time.Duration) error {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
@ -248,7 +248,7 @@ func waitForSyncComplete(ctx context.Context, a api.FullNode, r int, t time.Dura
|
|||||||
* A thin wrapper around lotus cli GetFullNodeAPI
|
* A thin wrapper around lotus cli GetFullNodeAPI
|
||||||
* Adds retry logic
|
* Adds retry logic
|
||||||
*/
|
*/
|
||||||
func getFullNodeAPI(ctx *cli.Context, r int, t time.Duration) (api.FullNode, jsonrpc.ClientCloser, error) {
|
func getFullNodeAPI(ctx *cli.Context, r int, t time.Duration) (v0api.FullNode, jsonrpc.ClientCloser, error) {
|
||||||
for i := 0; i < r; i++ {
|
for i := 0; i < r; i++ {
|
||||||
api, closer, err := lcli.GetFullNodeAPI(ctx)
|
api, closer, err := lcli.GetFullNodeAPI(ctx)
|
||||||
if err != nil && i == (r-1) {
|
if err != nil && i == (r-1) {
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
@ -318,7 +319,7 @@ func doExtractMessage(opts extractOpts) error {
|
|||||||
|
|
||||||
// resolveFromChain queries the chain for the provided message, using the block CID to
|
// resolveFromChain queries the chain for the provided message, using the block CID to
|
||||||
// speed up the query, if provided
|
// speed up the query, if provided
|
||||||
func resolveFromChain(ctx context.Context, api api.FullNode, mcid cid.Cid, block string) (msg *types.Message, execTs *types.TipSet, incTs *types.TipSet, err error) {
|
func resolveFromChain(ctx context.Context, api v0api.FullNode, mcid cid.Cid, block string) (msg *types.Message, execTs *types.TipSet, incTs *types.TipSet, err error) {
|
||||||
// Extract the full message.
|
// Extract the full message.
|
||||||
msg, err = api.ChainGetMessage(ctx, mcid)
|
msg, err = api.ChainGetMessage(ctx, mcid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -373,7 +374,7 @@ func resolveFromChain(ctx context.Context, api api.FullNode, mcid cid.Cid, block
|
|||||||
// as the previous tipset. In the context of vector generation, the target
|
// as the previous tipset. In the context of vector generation, the target
|
||||||
// tipset is the one where a message was executed, and the previous tipset is
|
// tipset is the one where a message was executed, and the previous tipset is
|
||||||
// the one where the message was included.
|
// the one where the message was included.
|
||||||
func fetchThisAndPrevTipset(ctx context.Context, api api.FullNode, target types.TipSetKey) (targetTs *types.TipSet, prevTs *types.TipSet, err error) {
|
func fetchThisAndPrevTipset(ctx context.Context, api v0api.FullNode, target types.TipSetKey) (targetTs *types.TipSet, prevTs *types.TipSet, err error) {
|
||||||
// get the tipset on which this message was "executed" on.
|
// get the tipset on which this message was "executed" on.
|
||||||
// https://github.com/filecoin-project/lotus/issues/2847
|
// https://github.com/filecoin-project/lotus/issues/2847
|
||||||
targetTs, err = api.ChainGetTipSet(ctx, target)
|
targetTs, err = api.ChainGetTipSet(ctx, target)
|
||||||
|
@ -9,13 +9,13 @@ import (
|
|||||||
"github.com/filecoin-project/go-jsonrpc"
|
"github.com/filecoin-project/go-jsonrpc"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FullAPI is a JSON-RPC client targeting a full node. It's initialized in a
|
// FullAPI is a JSON-RPC client targeting a full node. It's initialized in a
|
||||||
// cli.BeforeFunc.
|
// cli.BeforeFunc.
|
||||||
var FullAPI api.FullNode
|
var FullAPI v0api.FullNode
|
||||||
|
|
||||||
// Closer is the closer for the JSON-RPC client, which must be called on
|
// Closer is the closer for the JSON-RPC client, which must be called on
|
||||||
// cli.AfterFunc.
|
// cli.AfterFunc.
|
||||||
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
@ -13,7 +14,6 @@ import (
|
|||||||
"github.com/ipld/go-car"
|
"github.com/ipld/go-car"
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||||
"github.com/filecoin-project/lotus/chain/state"
|
"github.com/filecoin-project/lotus/chain/state"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
@ -23,13 +23,13 @@ import (
|
|||||||
// StateSurgeon is an object used to fetch and manipulate state.
|
// StateSurgeon is an object used to fetch and manipulate state.
|
||||||
type StateSurgeon struct {
|
type StateSurgeon struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
api api.FullNode
|
api v0api.FullNode
|
||||||
stores *Stores
|
stores *Stores
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSurgeon returns a state surgeon, an object used to fetch and manipulate
|
// NewSurgeon returns a state surgeon, an object used to fetch and manipulate
|
||||||
// state.
|
// state.
|
||||||
func NewSurgeon(ctx context.Context, api api.FullNode, stores *Stores) *StateSurgeon {
|
func NewSurgeon(ctx context.Context, api v0api.FullNode, stores *Stores) *StateSurgeon {
|
||||||
return &StateSurgeon{
|
return &StateSurgeon{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
api: api,
|
api: api,
|
||||||
@ -85,7 +85,7 @@ func (sg *StateSurgeon) GetMaskedStateTree(previousRoot cid.Cid, retain []addres
|
|||||||
|
|
||||||
// GetAccessedActors identifies the actors that were accessed during the
|
// GetAccessedActors identifies the actors that were accessed during the
|
||||||
// execution of a message.
|
// execution of a message.
|
||||||
func (sg *StateSurgeon) GetAccessedActors(ctx context.Context, a api.FullNode, mid cid.Cid) ([]address.Address, error) {
|
func (sg *StateSurgeon) GetAccessedActors(ctx context.Context, a v0api.FullNode, mid cid.Cid) ([]address.Address, error) {
|
||||||
log.Printf("calculating accessed actors during execution of message: %s", mid)
|
log.Printf("calculating accessed actors during execution of message: %s", mid)
|
||||||
msgInfo, err := a.StateSearchMsg(ctx, mid)
|
msgInfo, err := a.StateSearchMsg(ctx, mid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2,13 +2,13 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"log"
|
"log"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
dssync "github.com/ipfs/go-datastore/sync"
|
dssync "github.com/ipfs/go-datastore/sync"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/blockstore"
|
"github.com/filecoin-project/lotus/blockstore"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
@ -40,7 +40,7 @@ type Stores struct {
|
|||||||
// NewProxyingStores is a set of Stores backed by a proxying Blockstore that
|
// NewProxyingStores is a set of Stores backed by a proxying Blockstore that
|
||||||
// proxies Get requests for unknown CIDs to a Filecoin node, via the
|
// proxies Get requests for unknown CIDs to a Filecoin node, via the
|
||||||
// ChainReadObj RPC.
|
// ChainReadObj RPC.
|
||||||
func NewProxyingStores(ctx context.Context, api api.FullNode) *Stores {
|
func NewProxyingStores(ctx context.Context, api v0api.FullNode) *Stores {
|
||||||
ds := dssync.MutexWrap(ds.NewMapDatastore())
|
ds := dssync.MutexWrap(ds.NewMapDatastore())
|
||||||
bs := &proxyingBlockstore{
|
bs := &proxyingBlockstore{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
@ -85,7 +85,7 @@ type TracingBlockstore interface {
|
|||||||
// a Filecoin node via JSON-RPC.
|
// a Filecoin node via JSON-RPC.
|
||||||
type proxyingBlockstore struct {
|
type proxyingBlockstore struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
api api.FullNode
|
api v0api.FullNode
|
||||||
|
|
||||||
lk sync.Mutex
|
lk sync.Mutex
|
||||||
tracing bool
|
tracing bool
|
||||||
|
@ -3,6 +3,7 @@ package conformance
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
@ -10,14 +11,13 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/test-vectors/schema"
|
"github.com/filecoin-project/test-vectors/schema"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/chain/vm"
|
"github.com/filecoin-project/lotus/chain/vm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RecordingRand struct {
|
type RecordingRand struct {
|
||||||
reporter Reporter
|
reporter Reporter
|
||||||
api api.FullNode
|
api v0api.FullNode
|
||||||
|
|
||||||
// once guards the loading of the head tipset.
|
// once guards the loading of the head tipset.
|
||||||
// can be removed when https://github.com/filecoin-project/lotus/issues/4223
|
// can be removed when https://github.com/filecoin-project/lotus/issues/4223
|
||||||
@ -33,7 +33,7 @@ var _ vm.Rand = (*RecordingRand)(nil)
|
|||||||
// NewRecordingRand returns a vm.Rand implementation that proxies calls to a
|
// NewRecordingRand returns a vm.Rand implementation that proxies calls to a
|
||||||
// full Lotus node via JSON-RPC, and records matching rules and responses so
|
// full Lotus node via JSON-RPC, and records matching rules and responses so
|
||||||
// they can later be embedded in test vectors.
|
// they can later be embedded in test vectors.
|
||||||
func NewRecordingRand(reporter Reporter, api api.FullNode) *RecordingRand {
|
func NewRecordingRand(reporter Reporter, api v0api.FullNode) *RecordingRand {
|
||||||
return &RecordingRand{reporter: reporter, api: api}
|
return &RecordingRand{reporter: reporter, api: api}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,11 +5,11 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"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/api/v0api"
|
||||||
client "github.com/influxdata/influxdb1-client/v2"
|
client "github.com/influxdata/influxdb1-client/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Collect(ctx context.Context, api api.FullNode, influx client.Client, database string, height int64, headlag int) {
|
func Collect(ctx context.Context, api v0api.FullNode, influx client.Client, database string, height int64, headlag int) {
|
||||||
tipsetsCh, err := GetTips(ctx, api, abi.ChainEpoch(height), headlag)
|
tipsetsCh, err := GetTips(ctx, api, abi.ChainEpoch(height), headlag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -5,13 +5,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"math"
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"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/power"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/power"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/reward"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/reward"
|
||||||
@ -115,7 +115,7 @@ func NewPointFrom(p models.Point) *client.Point {
|
|||||||
return client.NewPointFrom(p)
|
return client.NewPointFrom(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RecordTipsetPoints(ctx context.Context, api api.FullNode, pl *PointList, tipset *types.TipSet) error {
|
func RecordTipsetPoints(ctx context.Context, api v0api.FullNode, pl *PointList, tipset *types.TipSet) error {
|
||||||
cids := []string{}
|
cids := []string{}
|
||||||
for _, cid := range tipset.Cids() {
|
for _, cid := range tipset.Cids() {
|
||||||
cids = append(cids, cid.String())
|
cids = append(cids, cid.String())
|
||||||
@ -238,7 +238,7 @@ func (ht *ApiIpldStore) Put(ctx context.Context, v interface{}) (cid.Cid, error)
|
|||||||
return cid.Undef, fmt.Errorf("Put is not implemented on ApiIpldStore")
|
return cid.Undef, fmt.Errorf("Put is not implemented on ApiIpldStore")
|
||||||
}
|
}
|
||||||
|
|
||||||
func RecordTipsetStatePoints(ctx context.Context, api api.FullNode, pl *PointList, tipset *types.TipSet) error {
|
func RecordTipsetStatePoints(ctx context.Context, api v0api.FullNode, pl *PointList, tipset *types.TipSet) error {
|
||||||
attoFil := types.NewInt(build.FilecoinPrecision).Int
|
attoFil := types.NewInt(build.FilecoinPrecision).Int
|
||||||
|
|
||||||
//TODO: StatePledgeCollateral API is not implemented and is commented out - re-enable this block once the API is implemented again.
|
//TODO: StatePledgeCollateral API is not implemented and is commented out - re-enable this block once the API is implemented again.
|
||||||
@ -299,7 +299,7 @@ type msgTag struct {
|
|||||||
exitcode uint8
|
exitcode uint8
|
||||||
}
|
}
|
||||||
|
|
||||||
func RecordTipsetMessagesPoints(ctx context.Context, api api.FullNode, pl *PointList, tipset *types.TipSet) error {
|
func RecordTipsetMessagesPoints(ctx context.Context, api v0api.FullNode, pl *PointList, tipset *types.TipSet) error {
|
||||||
cids := tipset.Cids()
|
cids := tipset.Cids()
|
||||||
if len(cids) == 0 {
|
if len(cids) == 0 {
|
||||||
return fmt.Errorf("no cids in tipset")
|
return fmt.Errorf("no cids in tipset")
|
||||||
|
@ -2,6 +2,7 @@ package stats
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ func getAPI(path string) (string, http.Header, error) {
|
|||||||
return "ws://" + addr + "/rpc/v0", headers, nil
|
return "ws://" + addr + "/rpc/v0", headers, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func WaitForSyncComplete(ctx context.Context, napi api.FullNode) error {
|
func WaitForSyncComplete(ctx context.Context, napi v0api.FullNode) error {
|
||||||
sync_complete:
|
sync_complete:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
@ -120,7 +121,7 @@ sync_complete:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetTips(ctx context.Context, api api.FullNode, lastHeight abi.ChainEpoch, headlag int) (<-chan *types.TipSet, error) {
|
func GetTips(ctx context.Context, api v0api.FullNode, lastHeight abi.ChainEpoch, headlag int) (<-chan *types.TipSet, error) {
|
||||||
chmain := make(chan *types.TipSet)
|
chmain := make(chan *types.TipSet)
|
||||||
|
|
||||||
hb := newHeadBuffer(headlag)
|
hb := newHeadBuffer(headlag)
|
||||||
@ -184,7 +185,7 @@ func GetTips(ctx context.Context, api api.FullNode, lastHeight abi.ChainEpoch, h
|
|||||||
return chmain, nil
|
return chmain, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadTipsets(ctx context.Context, api api.FullNode, curr *types.TipSet, lowestHeight abi.ChainEpoch) ([]*types.TipSet, error) {
|
func loadTipsets(ctx context.Context, api v0api.FullNode, curr *types.TipSet, lowestHeight abi.ChainEpoch) ([]*types.TipSet, error) {
|
||||||
tipsets := []*types.TipSet{}
|
tipsets := []*types.TipSet{}
|
||||||
for {
|
for {
|
||||||
if curr.Height() == 0 {
|
if curr.Height() == 0 {
|
||||||
@ -214,11 +215,11 @@ func loadTipsets(ctx context.Context, api api.FullNode, curr *types.TipSet, lowe
|
|||||||
return tipsets, nil
|
return tipsets, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetFullNodeAPI(ctx context.Context, repo string) (api.FullNode, jsonrpc.ClientCloser, error) {
|
func GetFullNodeAPI(ctx context.Context, repo string) (v0api.FullNode, jsonrpc.ClientCloser, error) {
|
||||||
addr, headers, err := getAPI(repo)
|
addr, headers, err := getAPI(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return client.NewFullNodeRPCV1(ctx, addr, headers)
|
return client.NewFullNodeRPCV0(ctx, addr, headers)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user