diff --git a/api/api_full.go b/api/api_full.go index b1abaabd7..b83f6df65 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -174,7 +174,7 @@ type FullNode interface { // // When maxFee is set to 0, MpoolPushMessage will guess appropriate fee // based on current chain conditions - MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee abi.TokenAmount) (*types.SignedMessage, error) + MpoolPushMessage(ctx context.Context, msg *types.Message, spec *MessageSendSpec) (*types.SignedMessage, error) // MpoolGetNonce gets next nonce for the specified sender. // Note that this method may not be atomic. Use MpoolPushMessage instead. diff --git a/api/apistruct/struct.go b/api/apistruct/struct.go index ad2eb0c80..4f16d56bb 100644 --- a/api/apistruct/struct.go +++ b/api/apistruct/struct.go @@ -104,11 +104,11 @@ type FullNodeStruct struct { MpoolSelect func(context.Context, types.TipSetKey, float64) ([]*types.SignedMessage, error) `perm:"read"` - MpoolPending func(context.Context, types.TipSetKey) ([]*types.SignedMessage, error) `perm:"read"` - MpoolPush func(context.Context, *types.SignedMessage) (cid.Cid, error) `perm:"write"` - MpoolPushMessage func(context.Context, *types.Message, abi.TokenAmount) (*types.SignedMessage, error) `perm:"sign"` - MpoolGetNonce func(context.Context, address.Address) (uint64, error) `perm:"read"` - MpoolSub func(context.Context) (<-chan api.MpoolUpdate, error) `perm:"read"` + MpoolPending func(context.Context, types.TipSetKey) ([]*types.SignedMessage, error) `perm:"read"` + MpoolPush func(context.Context, *types.SignedMessage) (cid.Cid, error) `perm:"write"` + MpoolPushMessage func(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error) `perm:"sign"` + MpoolGetNonce func(context.Context, address.Address) (uint64, error) `perm:"read"` + MpoolSub func(context.Context) (<-chan api.MpoolUpdate, error) `perm:"read"` MinerGetBaseInfo func(context.Context, address.Address, abi.ChainEpoch, types.TipSetKey) (*api.MiningBaseInfo, error) `perm:"read"` MinerCreateBlock func(context.Context, *api.BlockTemplate) (*types.BlockMsg, error) `perm:"write"` @@ -472,8 +472,8 @@ func (c *FullNodeStruct) MpoolPush(ctx context.Context, smsg *types.SignedMessag return c.Internal.MpoolPush(ctx, smsg) } -func (c *FullNodeStruct) MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee abi.TokenAmount) (*types.SignedMessage, error) { - return c.Internal.MpoolPushMessage(ctx, msg, maxFee) +func (c *FullNodeStruct) MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error) { + return c.Internal.MpoolPushMessage(ctx, msg, spec) } func (c *FullNodeStruct) MpoolSub(ctx context.Context) (<-chan api.MpoolUpdate, error) { diff --git a/api/test/paych.go b/api/test/paych.go index 69ee2cf7a..1b1d4e438 100644 --- a/api/test/paych.go +++ b/api/test/paych.go @@ -221,7 +221,7 @@ func waitForBlocks(ctx context.Context, t *testing.T, bm *blockMiner, paymentRec To: builtin.BurntFundsActorAddr, From: receiverAddr, Value: types.NewInt(0), - }, big.Zero()) + }, nil) if err != nil { t.Fatal(err) } @@ -307,7 +307,7 @@ func sendFunds(ctx context.Context, t *testing.T, sender TestNode, addr address. Value: amount, } - sm, err := sender.MpoolPushMessage(ctx, msg, big.Zero()) + sm, err := sender.MpoolPushMessage(ctx, msg, nil) if err != nil { t.Fatal(err) } diff --git a/api/types.go b/api/types.go index a094e4ec1..8e8c32122 100644 --- a/api/types.go +++ b/api/types.go @@ -4,6 +4,7 @@ import ( "encoding/json" "github.com/filecoin-project/go-address" "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/miner" "github.com/libp2p/go-libp2p-core/peer" @@ -76,3 +77,19 @@ func NewApiMinerInfo(info *miner.MinerInfo) MinerInfo { return mi } + +type MessageSendSpec struct { + MaxFee abi.TokenAmount +} + +var DefaultMessageSendSpec = MessageSendSpec{ + MaxFee: big.Zero(), +} + +func (ms *MessageSendSpec) Get() MessageSendSpec { + if ms == nil { + return DefaultMessageSendSpec + } + + return *ms +} diff --git a/chain/market/fundmgr.go b/chain/market/fundmgr.go index a0d778de6..574e718a0 100644 --- a/chain/market/fundmgr.go +++ b/chain/market/fundmgr.go @@ -60,7 +60,7 @@ func StartFundManager(lc fx.Lifecycle, api API) *FundMgr { type fundMgrAPI interface { StateMarketBalance(context.Context, address.Address, types.TipSetKey) (api.MarketBalance, error) - MpoolPushMessage(context.Context, *types.Message, abi.TokenAmount) (*types.SignedMessage, error) + MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error) StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error) } @@ -149,7 +149,7 @@ func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr, wallet address.Add Value: toAdd, Method: builtin.MethodsMarket.AddBalance, Params: params, - }, big.Zero()) + }, nil) if err != nil { return cid.Undef, err } diff --git a/chain/market/fundmgr_test.go b/chain/market/fundmgr_test.go index f2378d50c..d1b0fb7e6 100644 --- a/chain/market/fundmgr_test.go +++ b/chain/market/fundmgr_test.go @@ -36,7 +36,7 @@ func (fapi *fakeAPI) StateMarketBalance(context.Context, address.Address, types. return fapi.returnedBalance, fapi.returnedBalanceErr } -func (fapi *fakeAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee abi.TokenAmount) (*types.SignedMessage, error) { +func (fapi *fakeAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error) { fapi.receivedMessage = msg return &types.SignedMessage{ Message: *msg, diff --git a/cli/chain.go b/cli/chain.go index d72f438a9..22c35abb3 100644 --- a/cli/chain.go +++ b/cli/chain.go @@ -1007,7 +1007,7 @@ var slashConsensusFault = &cli.Command{ Params: enc, } - smsg, err := api.MpoolPushMessage(ctx, msg, big.Zero()) + smsg, err := api.MpoolPushMessage(ctx, msg, nil) if err != nil { return err } diff --git a/cli/send.go b/cli/send.go index 6ef2c4c4c..ecec42191 100644 --- a/cli/send.go +++ b/cli/send.go @@ -13,7 +13,6 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/specs-actors/actors/abi" - "github.com/filecoin-project/specs-actors/actors/abi/big" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/stmgr" @@ -157,7 +156,7 @@ var sendCmd = &cli.Command{ } fmt.Println(sm.Cid()) } else { - sm, err := api.MpoolPushMessage(ctx, msg, big.Zero()) + sm, err := api.MpoolPushMessage(ctx, msg, nil) if err != nil { return err } diff --git a/cmd/chain-noise/main.go b/cmd/chain-noise/main.go index 44131e11b..1decd0c0f 100644 --- a/cmd/chain-noise/main.go +++ b/cmd/chain-noise/main.go @@ -7,7 +7,6 @@ import ( "os" "time" - "github.com/filecoin-project/specs-actors/actors/abi/big" "github.com/filecoin-project/specs-actors/actors/crypto" "github.com/filecoin-project/go-address" @@ -80,7 +79,7 @@ func sendSmallFundsTxs(ctx context.Context, api api.FullNode, from address.Addre Value: types.NewInt(1), } - smsg, err := api.MpoolPushMessage(ctx, msg, big.Zero()) + smsg, err := api.MpoolPushMessage(ctx, msg, nil) if err != nil { return err } diff --git a/cmd/lotus-fountain/main.go b/cmd/lotus-fountain/main.go index dd8ad4935..84538e61b 100644 --- a/cmd/lotus-fountain/main.go +++ b/cmd/lotus-fountain/main.go @@ -23,7 +23,6 @@ import ( "github.com/filecoin-project/sector-storage/ffiwrapper" "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/power" @@ -280,7 +279,7 @@ func (h *handler) send(w http.ResponseWriter, r *http.Request) { Value: types.BigInt(h.sendPerRequest), From: h.from, To: to, - }, big.Zero()) + }, nil) if err != nil { w.WriteHeader(400) _, _ = w.Write([]byte(err.Error())) @@ -351,7 +350,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) { Value: types.BigInt(h.sendPerRequest), From: h.from, To: owner, - }, big.Zero()) + }, nil) if err != nil { w.WriteHeader(400) w.Write([]byte("pushfunds: " + err.Error())) @@ -387,7 +386,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) { Params: params, } - signed, err := h.api.MpoolPushMessage(r.Context(), createStorageMinerMsg, big.Zero()) + signed, err := h.api.MpoolPushMessage(r.Context(), createStorageMinerMsg, nil) if err != nil { w.WriteHeader(400) w.Write([]byte(err.Error())) diff --git a/cmd/lotus-pcr/main.go b/cmd/lotus-pcr/main.go index eb7331746..fe75349a2 100644 --- a/cmd/lotus-pcr/main.go +++ b/cmd/lotus-pcr/main.go @@ -20,7 +20,6 @@ import ( "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" @@ -206,7 +205,7 @@ type processTipSetApi interface { 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) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) - MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee abi.TokenAmount) (*types.SignedMessage, error) + MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, 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) } @@ -328,7 +327,7 @@ func ProcessTipset(ctx context.Context, api processTipSetApi, tipset *types.TipS failures := 0 refundSum.SetUint64(0) for _, msg := range messages { - if _, err = api.MpoolPushMessage(ctx, msg, big.Zero()); err != nil { + if _, err = api.MpoolPushMessage(ctx, msg, nil); err != nil { log.Errorw("failed to MpoolPushMessage", "err", err, "msg", msg) failures = failures + 1 continue diff --git a/cmd/lotus-shed/verifreg.go b/cmd/lotus-shed/verifreg.go index e478e4472..6e24dc0b6 100644 --- a/cmd/lotus-shed/verifreg.go +++ b/cmd/lotus-shed/verifreg.go @@ -7,7 +7,6 @@ import ( "golang.org/x/xerrors" "github.com/filecoin-project/go-address" - "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/verifreg" "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -76,7 +75,7 @@ var verifRegAddVerifierCmd = &cli.Command{ Params: params, } - smsg, err := api.MpoolPushMessage(ctx, msg, big.Zero()) + smsg, err := api.MpoolPushMessage(ctx, msg, nil) if err != nil { return err } @@ -150,7 +149,7 @@ var verifRegVerifyClientCmd = &cli.Command{ Params: params, } - smsg, err := api.MpoolPushMessage(ctx, msg, big.Zero()) + smsg, err := api.MpoolPushMessage(ctx, msg, nil) if err != nil { return err } diff --git a/cmd/lotus-storage-miner/actor.go b/cmd/lotus-storage-miner/actor.go index 96a38a015..18e3796a3 100644 --- a/cmd/lotus-storage-miner/actor.go +++ b/cmd/lotus-storage-miner/actor.go @@ -7,7 +7,6 @@ import ( "github.com/urfave/cli/v2" "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/miner" "github.com/filecoin-project/lotus/chain/actors" @@ -82,7 +81,7 @@ var actorSetAddrsCmd = &cli.Command{ GasLimit: gasLimit, Method: 18, Params: params, - }, big.Zero()) + }, nil) if err != nil { return err } diff --git a/cmd/lotus-storage-miner/init.go b/cmd/lotus-storage-miner/init.go index af7a3fd04..56575c0ca 100644 --- a/cmd/lotus-storage-miner/init.go +++ b/cmd/lotus-storage-miner/init.go @@ -28,7 +28,6 @@ import ( "github.com/filecoin-project/sector-storage/ffiwrapper" "github.com/filecoin-project/sector-storage/stores" "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/market" miner2 "github.com/filecoin-project/specs-actors/actors/builtin/miner" @@ -561,7 +560,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address. GasPremium: gasPrice, } - smsg, err := api.MpoolPushMessage(ctx, msg, big.Zero()) + smsg, err := api.MpoolPushMessage(ctx, msg, nil) if err != nil { return err } @@ -641,7 +640,7 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID, GasPremium: gasPrice, } - signed, err := api.MpoolPushMessage(ctx, createStorageMinerMsg, big.Zero()) + signed, err := api.MpoolPushMessage(ctx, createStorageMinerMsg, nil) if err != nil { return address.Undef, err } diff --git a/cmd/lotus-storage-miner/rewards.go b/cmd/lotus-storage-miner/rewards.go index bb6773bc1..fa1fcb4dc 100644 --- a/cmd/lotus-storage-miner/rewards.go +++ b/cmd/lotus-storage-miner/rewards.go @@ -5,7 +5,6 @@ import ( "github.com/urfave/cli/v2" - "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" @@ -67,7 +66,7 @@ var rewardsRedeemCmd = &cli.Command{ Value: types.NewInt(0), Method: builtin.MethodsMiner.WithdrawBalance, Params: params, - }, big.Zero()) + }, nil) if err != nil { return err } diff --git a/markets/storageadapter/client.go b/markets/storageadapter/client.go index b95c6fe17..f7627fa7a 100644 --- a/markets/storageadapter/client.go +++ b/markets/storageadapter/client.go @@ -23,7 +23,6 @@ import ( "github.com/filecoin-project/lotus/markets/utils" "github.com/filecoin-project/lotus/node/impl/full" "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" samarket "github.com/filecoin-project/specs-actors/actors/builtin/market" "github.com/filecoin-project/specs-actors/actors/builtin/miner" @@ -127,7 +126,7 @@ func (c *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address, From: addr, Value: amount, Method: builtin.MethodsMarket.AddBalance, - }, big.Zero()) + }, nil) if err != nil { return cid.Undef, err } diff --git a/markets/storageadapter/provider.go b/markets/storageadapter/provider.go index b67becefa..788fd769a 100644 --- a/markets/storageadapter/provider.go +++ b/markets/storageadapter/provider.go @@ -15,7 +15,6 @@ import ( "github.com/filecoin-project/go-fil-markets/shared" "github.com/filecoin-project/go-fil-markets/storagemarket" "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/market" "github.com/filecoin-project/specs-actors/actors/builtin/miner" @@ -80,7 +79,7 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark Value: types.NewInt(0), Method: builtin.MethodsMarket.PublishStorageDeals, Params: params, - }, big.Zero()) + }, nil) if err != nil { return cid.Undef, err } @@ -178,7 +177,7 @@ func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address From: addr, Value: amount, Method: builtin.MethodsMarket.AddBalance, - }, big.Zero()) + }, nil) if err != nil { return cid.Undef, err } diff --git a/node/impl/full/mpool.go b/node/impl/full/mpool.go index 313f6c40c..f77085d04 100644 --- a/node/impl/full/mpool.go +++ b/node/impl/full/mpool.go @@ -15,7 +15,6 @@ import ( "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/node/modules/dtypes" - "github.com/filecoin-project/specs-actors/actors/abi/big" ) type MpoolAPI struct { @@ -131,7 +130,7 @@ func capGasFee(msg *types.Message, maxFee abi.TokenAmount) { msg.GasPremium = big.Div(big.Div(big.Mul(minerFee, maxFee), totalFee), gl) } -func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee abi.TokenAmount) (*types.SignedMessage, error) { +func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error) { { fromA, err := a.Stmgr.ResolveToKeyAddress(ctx, msg.From, nil) if err != nil { @@ -171,7 +170,7 @@ func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, max msg.GasFeeCap = big.Add(feeCap, msg.GasPremium) } - capGasFee(msg, maxFee) + capGasFee(msg, spec.Get().MaxFee) sign := func(from address.Address, nonce uint64) (*types.SignedMessage, error) { msg.Nonce = nonce diff --git a/node/impl/full/multisig.go b/node/impl/full/multisig.go index 9889c915c..88ff4cdc9 100644 --- a/node/impl/full/multisig.go +++ b/node/impl/full/multisig.go @@ -78,7 +78,7 @@ func (a *MsigAPI) MsigCreate(ctx context.Context, req uint64, addrs []address.Ad } // send the message out to the network - smsg, err := a.MpoolAPI.MpoolPushMessage(ctx, &msg, big.Zero()) + smsg, err := a.MpoolAPI.MpoolPushMessage(ctx, &msg, nil) if err != nil { return cid.Undef, err } @@ -122,7 +122,7 @@ func (a *MsigAPI) MsigPropose(ctx context.Context, msig address.Address, to addr Params: enc, } - smsg, err := a.MpoolAPI.MpoolPushMessage(ctx, msg, big.Zero()) + smsg, err := a.MpoolAPI.MpoolPushMessage(ctx, msg, nil) if err != nil { return cid.Undef, xerrors.Errorf("failed to push message: %w", err) } @@ -236,7 +236,7 @@ func (a *MsigAPI) msigApproveOrCancel(ctx context.Context, operation api.MsigPro Params: enc, } - smsg, err := a.MpoolAPI.MpoolPushMessage(ctx, msg, big.Zero()) + smsg, err := a.MpoolAPI.MpoolPushMessage(ctx, msg, nil) if err != nil { return cid.Undef, err } diff --git a/node/impl/paych/paych.go b/node/impl/paych/paych.go index 7600270b5..abbd2b5a5 100644 --- a/node/impl/paych/paych.go +++ b/node/impl/paych/paych.go @@ -9,7 +9,6 @@ import ( "golang.org/x/xerrors" "github.com/filecoin-project/go-address" - "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/paych" @@ -211,7 +210,7 @@ func (a *PaychAPI) PaychVoucherSubmit(ctx context.Context, ch address.Address, s Params: enc, } - smsg, err := a.MpoolPushMessage(ctx, msg, big.Zero()) + smsg, err := a.MpoolPushMessage(ctx, msg, nil) if err != nil { return cid.Undef, err } diff --git a/node/node_test.go b/node/node_test.go index 621cb0c9a..030132e23 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -110,7 +110,7 @@ func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, a Value: types.NewInt(0), } - _, err = tnd.MpoolPushMessage(ctx, msg, big.Zero()) + _, err = tnd.MpoolPushMessage(ctx, msg, nil) require.NoError(t, err) // start node diff --git a/paychmgr/manager.go b/paychmgr/manager.go index b3f4c6f4f..6d8b8d912 100644 --- a/paychmgr/manager.go +++ b/paychmgr/manager.go @@ -2,7 +2,6 @@ package paychmgr import ( "context" - "github.com/filecoin-project/specs-actors/actors/abi" "sync" "github.com/filecoin-project/lotus/node/modules/helpers" @@ -45,7 +44,7 @@ type stateManagerAPI interface { // paychAPI defines the API methods needed by the payment channel manager type paychAPI interface { StateWaitMsg(ctx context.Context, msg cid.Cid, confidence uint64) (*api.MsgLookup, error) - MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee abi.TokenAmount) (*types.SignedMessage, error) + MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee *api.MessageSendSpec) (*types.SignedMessage, error) } // managerAPI defines all methods needed by the manager diff --git a/paychmgr/mock_test.go b/paychmgr/mock_test.go index 44dc5f1db..1cb66e1af 100644 --- a/paychmgr/mock_test.go +++ b/paychmgr/mock_test.go @@ -3,7 +3,6 @@ package paychmgr import ( "context" "fmt" - "github.com/filecoin-project/specs-actors/actors/abi" "sync" "github.com/filecoin-project/go-address" @@ -157,7 +156,7 @@ func (pchapi *mockPaychAPI) close() { } } -func (pchapi *mockPaychAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, maxFee abi.TokenAmount) (*types.SignedMessage, error) { +func (pchapi *mockPaychAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error) { pchapi.lk.Lock() defer pchapi.lk.Unlock() diff --git a/paychmgr/paych.go b/paychmgr/paych.go index 70674de3b..ba110b186 100644 --- a/paychmgr/paych.go +++ b/paychmgr/paych.go @@ -403,7 +403,7 @@ func (ca *channelAccessor) settle(ctx context.Context, ch address.Address) (cid. Value: types.NewInt(0), Method: builtin.MethodsPaych.Settle, } - smgs, err := ca.api.MpoolPushMessage(ctx, msg, big.Zero()) + smgs, err := ca.api.MpoolPushMessage(ctx, msg, nil) if err != nil { return cid.Undef, err } @@ -433,7 +433,7 @@ func (ca *channelAccessor) collect(ctx context.Context, ch address.Address) (cid Method: builtin.MethodsPaych.Collect, } - smsg, err := ca.api.MpoolPushMessage(ctx, msg, big.Zero()) + smsg, err := ca.api.MpoolPushMessage(ctx, msg, nil) if err != nil { return cid.Undef, err } diff --git a/paychmgr/simple.go b/paychmgr/simple.go index 75e11092c..b2f3c4404 100644 --- a/paychmgr/simple.go +++ b/paychmgr/simple.go @@ -370,7 +370,7 @@ func (ca *channelAccessor) createPaych(ctx context.Context, from, to address.Add Params: enc, } - smsg, err := ca.api.MpoolPushMessage(ctx, msg, big.Zero()) + smsg, err := ca.api.MpoolPushMessage(ctx, msg, nil) if err != nil { return cid.Undef, xerrors.Errorf("initializing paych actor: %w", err) } @@ -449,7 +449,7 @@ func (ca *channelAccessor) addFunds(ctx context.Context, channelInfo *ChannelInf Method: 0, } - smsg, err := ca.api.MpoolPushMessage(ctx, msg, big.Zero()) + smsg, err := ca.api.MpoolPushMessage(ctx, msg, nil) if err != nil { return nil, err } diff --git a/storage/adapter_storage_miner.go b/storage/adapter_storage_miner.go index 121fb82f9..1fccc361a 100644 --- a/storage/adapter_storage_miner.go +++ b/storage/adapter_storage_miner.go @@ -3,6 +3,7 @@ package storage import ( "bytes" "context" + "github.com/filecoin-project/lotus/api" "github.com/ipfs/go-cid" cbg "github.com/whyrusleeping/cbor-gen" @@ -246,7 +247,7 @@ func (s SealingAPIAdapter) SendMsg(ctx context.Context, from, to address.Address Params: params, } - smsg, err := s.delegate.MpoolPushMessage(ctx, &msg, maxFee) + smsg, err := s.delegate.MpoolPushMessage(ctx, &msg, &api.MessageSendSpec{MaxFee: maxFee}) if err != nil { return cid.Undef, err } diff --git a/storage/miner.go b/storage/miner.go index c18c36cc6..006f01632 100644 --- a/storage/miner.go +++ b/storage/miner.go @@ -67,7 +67,7 @@ type storageMinerApi interface { StateMinerFaults(context.Context, address.Address, types.TipSetKey) (abi.BitField, error) StateMinerRecoveries(context.Context, address.Address, types.TipSetKey) (abi.BitField, error) - MpoolPushMessage(context.Context, *types.Message, abi.TokenAmount) (*types.SignedMessage, error) + MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error) ChainHead(context.Context) (*types.TipSet, error) ChainNotify(context.Context) (<-chan []*api.HeadChange, error) diff --git a/storage/wdpost_run.go b/storage/wdpost_run.go index 250445b69..e9e626533 100644 --- a/storage/wdpost_run.go +++ b/storage/wdpost_run.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "errors" + "github.com/filecoin-project/lotus/api" "time" "github.com/filecoin-project/go-bitfield" @@ -177,7 +178,7 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, dlIdx uin Value: types.NewInt(0), } - sm, err := s.api.MpoolPushMessage(ctx, msg, abi.TokenAmount(s.feeCfg.MaxWindowPoStGasFee)) + sm, err := s.api.MpoolPushMessage(ctx, msg, &api.MessageSendSpec{MaxFee: abi.TokenAmount(s.feeCfg.MaxWindowPoStGasFee)}) if err != nil { return xerrors.Errorf("pushing message to mpool: %w", err) } @@ -259,7 +260,7 @@ func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64, Value: types.NewInt(0), // TODO: Is there a fee? } - sm, err := s.api.MpoolPushMessage(ctx, msg, abi.TokenAmount(s.feeCfg.MaxWindowPoStGasFee)) + sm, err := s.api.MpoolPushMessage(ctx, msg, &api.MessageSendSpec{MaxFee: abi.TokenAmount(s.feeCfg.MaxWindowPoStGasFee)}) if err != nil { return xerrors.Errorf("pushing message to mpool: %w", err) } @@ -465,7 +466,7 @@ func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.Submi } // TODO: consider maybe caring about the output - sm, err := s.api.MpoolPushMessage(ctx, msg, abi.TokenAmount(s.feeCfg.MaxWindowPoStGasFee)) + sm, err := s.api.MpoolPushMessage(ctx, msg, &api.MessageSendSpec{MaxFee: abi.TokenAmount(s.feeCfg.MaxWindowPoStGasFee)}) if err != nil { return xerrors.Errorf("pushing message to mpool: %w", err) }