Fix tests

This commit is contained in:
Łukasz Magiera 2020-08-12 20:03:07 +02:00
parent 03c1776b43
commit 6fe743f3a9
8 changed files with 30 additions and 24 deletions

View File

@ -221,7 +221,7 @@ func waitForBlocks(ctx context.Context, t *testing.T, bm *blockMiner, paymentRec
To: builtin.BurntFundsActorAddr, To: builtin.BurntFundsActorAddr,
From: receiverAddr, From: receiverAddr,
Value: types.NewInt(0), Value: types.NewInt(0),
}) }, big.Zero())
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -307,7 +307,7 @@ func sendFunds(ctx context.Context, t *testing.T, sender TestNode, addr address.
Value: amount, Value: amount,
} }
sm, err := sender.MpoolPushMessage(ctx, msg) sm, err := sender.MpoolPushMessage(ctx, msg, big.Zero())
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -36,7 +36,7 @@ func (fapi *fakeAPI) StateMarketBalance(context.Context, address.Address, types.
return fapi.returnedBalance, fapi.returnedBalanceErr return fapi.returnedBalance, fapi.returnedBalanceErr
} }
func (fapi *fakeAPI) MpoolPushMessage(ctx context.Context, msg *types.Message) (*types.SignedMessage, error) { func (fapi *fakeAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee abi.TokenAmount) (*types.SignedMessage, error) {
fapi.receivedMessage = msg fapi.receivedMessage = msg
return &types.SignedMessage{ return &types.SignedMessage{
Message: *msg, Message: *msg,

View File

@ -7,6 +7,7 @@ import (
"os" "os"
"time" "time"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/specs-actors/actors/crypto" "github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
@ -79,7 +80,7 @@ func sendSmallFundsTxs(ctx context.Context, api api.FullNode, from address.Addre
Value: types.NewInt(1), Value: types.NewInt(1),
} }
smsg, err := api.MpoolPushMessage(ctx, msg) smsg, err := api.MpoolPushMessage(ctx, msg, big.Zero())
if err != nil { if err != nil {
return err return err
} }

View File

@ -23,6 +23,7 @@ import (
"github.com/filecoin-project/sector-storage/ffiwrapper" "github.com/filecoin-project/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/power" "github.com/filecoin-project/specs-actors/actors/builtin/power"
@ -279,7 +280,7 @@ func (h *handler) send(w http.ResponseWriter, r *http.Request) {
Value: types.BigInt(h.sendPerRequest), Value: types.BigInt(h.sendPerRequest),
From: h.from, From: h.from,
To: to, To: to,
}) }, big.Zero())
if err != nil { if err != nil {
w.WriteHeader(400) w.WriteHeader(400)
_, _ = w.Write([]byte(err.Error())) _, _ = w.Write([]byte(err.Error()))
@ -350,7 +351,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
Value: types.BigInt(h.sendPerRequest), Value: types.BigInt(h.sendPerRequest),
From: h.from, From: h.from,
To: owner, To: owner,
}) }, big.Zero())
if err != nil { if err != nil {
w.WriteHeader(400) w.WriteHeader(400)
w.Write([]byte("pushfunds: " + err.Error())) w.Write([]byte("pushfunds: " + err.Error()))
@ -386,7 +387,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
Params: params, Params: params,
} }
signed, err := h.api.MpoolPushMessage(r.Context(), createStorageMinerMsg) signed, err := h.api.MpoolPushMessage(r.Context(), createStorageMinerMsg, big.Zero())
if err != nil { if err != nil {
w.WriteHeader(400) w.WriteHeader(400)
w.Write([]byte(err.Error())) w.Write([]byte(err.Error()))

View File

@ -19,15 +19,17 @@ import (
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/api" "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"
"github.com/filecoin-project/lotus/tools/stats" "github.com/filecoin-project/lotus/tools/stats"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
) )
var log = logging.Logger("main") var log = logging.Logger("main")
@ -204,7 +206,7 @@ type processTipSetApi interface {
ChainGetParentReceipts(ctx context.Context, blockCid cid.Cid) ([]*types.MessageReceipt, error) ChainGetParentReceipts(ctx context.Context, blockCid cid.Cid) ([]*types.MessageReceipt, error)
StateMinerInitialPledgeCollateral(ctx context.Context, addr address.Address, precommitInfo miner.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error) StateMinerInitialPledgeCollateral(ctx context.Context, addr address.Address, precommitInfo miner.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error)
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error)
MpoolPushMessage(ctx context.Context, msg *types.Message) (*types.SignedMessage, error) MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee abi.TokenAmount) (*types.SignedMessage, error)
GasEstimateGasPremium(ctx context.Context, nblocksincl uint64, sender address.Address, gaslimit int64, tsk types.TipSetKey) (types.BigInt, error) GasEstimateGasPremium(ctx context.Context, nblocksincl uint64, sender address.Address, gaslimit int64, tsk types.TipSetKey) (types.BigInt, error)
WalletBalance(ctx context.Context, addr address.Address) (types.BigInt, error) WalletBalance(ctx context.Context, addr address.Address) (types.BigInt, error)
} }
@ -326,7 +328,7 @@ func ProcessTipset(ctx context.Context, api processTipSetApi, tipset *types.TipS
failures := 0 failures := 0
refundSum.SetUint64(0) refundSum.SetUint64(0)
for _, msg := range messages { for _, msg := range messages {
if _, err = api.MpoolPushMessage(ctx, msg); err != nil { if _, err = api.MpoolPushMessage(ctx, msg, big.Zero()); err != nil {
log.Errorw("failed to MpoolPushMessage", "err", err, "msg", msg) log.Errorw("failed to MpoolPushMessage", "err", err, "msg", msg)
failures = failures + 1 failures = failures + 1
continue continue

View File

@ -3,19 +3,20 @@ package main
import ( import (
"fmt" "fmt"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/build"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/go-address"
lcli "github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/lotus/api/apibstore"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/verifreg" "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
"github.com/filecoin-project/specs-actors/actors/util/adt" "github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/lotus/api/apibstore"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli"
cbor "github.com/ipfs/go-ipld-cbor" cbor "github.com/ipfs/go-ipld-cbor"
) )
@ -75,7 +76,7 @@ var verifRegAddVerifierCmd = &cli.Command{
Params: params, Params: params,
} }
smsg, err := api.MpoolPushMessage(ctx, msg) smsg, err := api.MpoolPushMessage(ctx, msg, big.Zero())
if err != nil { if err != nil {
return err return err
} }
@ -149,7 +150,7 @@ var verifRegVerifyClientCmd = &cli.Command{
Params: params, Params: params,
} }
smsg, err := api.MpoolPushMessage(ctx, msg) smsg, err := api.MpoolPushMessage(ctx, msg, big.Zero())
if err != nil { if err != nil {
return err return err
} }

View File

@ -110,7 +110,7 @@ func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, a
Value: types.NewInt(0), Value: types.NewInt(0),
} }
_, err = tnd.MpoolPushMessage(ctx, msg) _, err = tnd.MpoolPushMessage(ctx, msg, big.Zero())
require.NoError(t, err) require.NoError(t, err)
// start node // start node

View File

@ -3,6 +3,7 @@ package paychmgr
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/filecoin-project/specs-actors/actors/abi"
"sync" "sync"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
@ -156,7 +157,7 @@ func (pchapi *mockPaychAPI) close() {
} }
} }
func (pchapi *mockPaychAPI) MpoolPushMessage(ctx context.Context, msg *types.Message) (*types.SignedMessage, error) { func (pchapi *mockPaychAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee abi.TokenAmount) (*types.SignedMessage, error) {
pchapi.lk.Lock() pchapi.lk.Lock()
defer pchapi.lk.Unlock() defer pchapi.lk.Unlock()