This commit is contained in:
Aayush 2023-08-22 11:51:00 -04:00
parent 89f66dde93
commit 5a901b5eb6
8 changed files with 19 additions and 17 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -15,7 +15,8 @@ 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/api"
"github.com/filecoin-project/lotus/api/v0api" lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/api/v1api"
"github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin"
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/actors/builtin/reward" "github.com/filecoin-project/lotus/chain/actors/builtin/reward"
@ -207,7 +208,7 @@ func doExtractMessage(opts extractOpts) error {
// TODO sometimes this returns a nil receipt and no error ¯\_(ツ)_/¯ // TODO sometimes this returns a nil receipt and no error ¯\_(ツ)_/¯
// ex: https://filfox.info/en/message/bafy2bzacebpxw3yiaxzy2bako62akig46x3imji7fewszen6fryiz6nymu2b2 // ex: https://filfox.info/en/message/bafy2bzacebpxw3yiaxzy2bako62akig46x3imji7fewszen6fryiz6nymu2b2
// This code is lenient and skips receipt comparison in case of a nil receipt. // This code is lenient and skips receipt comparison in case of a nil receipt.
rec, err := FullAPI.StateGetReceipt(ctx, mcid, execTs.Key()) rec, err := FullAPI.StateSearchMsg(ctx, execTs.Key(), mcid, api.LookbackNoLimit, false)
if err != nil { if err != nil {
return fmt.Errorf("failed to find receipt on chain: %w", err) return fmt.Errorf("failed to find receipt on chain: %w", err)
} }
@ -217,9 +218,9 @@ func doExtractMessage(opts extractOpts) error {
var receipt *schema.Receipt var receipt *schema.Receipt
if rec != nil { if rec != nil {
receipt = &schema.Receipt{ receipt = &schema.Receipt{
ExitCode: int64(rec.ExitCode), ExitCode: int64(rec.Receipt.ExitCode),
ReturnValue: rec.Return, ReturnValue: rec.Receipt.Return,
GasUsed: rec.GasUsed, GasUsed: rec.Receipt.GasUsed,
} }
reporter := new(conformance.LogReporter) reporter := new(conformance.LogReporter)
@ -326,7 +327,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 v0api.FullNode, mcid cid.Cid, block string) (msg *types.Message, execTs *types.TipSet, incTs *types.TipSet, err error) { func resolveFromChain(ctx context.Context, api lapi.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 {
@ -339,7 +340,7 @@ func resolveFromChain(ctx context.Context, api v0api.FullNode, mcid cid.Cid, blo
log.Printf("locating message in blockchain") log.Printf("locating message in blockchain")
// Locate the message. // Locate the message.
msgInfo, err := api.StateSearchMsg(ctx, mcid) msgInfo, err := api.StateSearchMsg(ctx, types.EmptyTSK, mcid, lapi.LookbackNoLimit, false)
if err != nil { if err != nil {
return nil, nil, nil, fmt.Errorf("failed to locate message: %w", err) return nil, nil, nil, fmt.Errorf("failed to locate message: %w", err)
} }
@ -384,7 +385,7 @@ func resolveFromChain(ctx context.Context, api v0api.FullNode, mcid cid.Cid, blo
// 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 v0api.FullNode, target types.TipSetKey) (targetTs *types.TipSet, prevTs *types.TipSet, err error) { func fetchThisAndPrevTipset(ctx context.Context, api v1api.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)

View File

@ -102,7 +102,7 @@ func initialize(c *cli.Context) error {
// Make the API client. // Make the API client.
var err error var err error
if FullAPI, Closer, err = lcli.GetFullNodeAPI(c); err != nil { if FullAPI, Closer, err = lcli.GetFullNodeAPIV1(c); err != nil {
err = fmt.Errorf("failed to locate Lotus node; err: %w", err) err = fmt.Errorf("failed to locate Lotus node; err: %w", err)
} }
return err return err

View File

@ -14,7 +14,8 @@ import (
"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/v0api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/api/v1api"
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"
@ -24,13 +25,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 v0api.FullNode api v1api.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 v0api.FullNode, stores *Stores) *StateSurgeon { func NewSurgeon(ctx context.Context, api v1api.FullNode, stores *Stores) *StateSurgeon {
return &StateSurgeon{ return &StateSurgeon{
ctx: ctx, ctx: ctx,
api: api, api: api,
@ -86,9 +87,9 @@ 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 v0api.FullNode, mid cid.Cid) ([]address.Address, error) { func (sg *StateSurgeon) GetAccessedActors(ctx context.Context, a v1api.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, types.EmptyTSK, mid, api.LookbackNoLimit, false)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -18,7 +18,7 @@ import (
format "github.com/ipfs/go-ipld-format" format "github.com/ipfs/go-ipld-format"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"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/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/adt"
) )
@ -39,7 +39,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 v0api.FullNode) *Stores { func NewProxyingStores(ctx context.Context, api v1api.FullNode) *Stores {
ds := dssync.MutexWrap(ds.NewMapDatastore()) ds := dssync.MutexWrap(ds.NewMapDatastore())
bs := &proxyingBlockstore{ bs := &proxyingBlockstore{
ctx: ctx, ctx: ctx,
@ -84,7 +84,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 v0api.FullNode api v1api.FullNode
lk sync.Mutex lk sync.Mutex
tracing bool tracing bool