Merge branch 'master' into inmem-journal

This commit is contained in:
Raúl Kripalani 2020-09-04 21:02:28 +01:00
commit 35a8f7ebca
3 changed files with 8 additions and 12 deletions

View File

@ -6,8 +6,8 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer" datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/lotus/build"
"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/miner" "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
@ -96,7 +96,8 @@ type MessageSendSpec struct {
} }
var DefaultMessageSendSpec = MessageSendSpec{ var DefaultMessageSendSpec = MessageSendSpec{
MaxFee: big.Zero(), // MaxFee of 0.1FIL
MaxFee: abi.NewTokenAmount(int64(build.FilecoinPrecision) / 10),
} }
func (ms *MessageSendSpec) Get() MessageSendSpec { func (ms *MessageSendSpec) Get() MessageSendSpec {

View File

@ -125,9 +125,9 @@ func TestPaymentChannelStatus(t *testing.T) {
channelAmt := uint64(100) channelAmt := uint64(100)
create := make(chan string) create := make(chan string)
go func() { go func() {
// creator: paych get <creator> <receiver> <amount> // creator: paych add-funds <creator> <receiver> <amount>
cmd = []string{creatorAddr.String(), receiverAddr.String(), fmt.Sprintf("%d", channelAmt)} cmd = []string{creatorAddr.String(), receiverAddr.String(), fmt.Sprintf("%d", channelAmt)}
create <- creatorCLI.runCmd(paychGetCmd, cmd) create <- creatorCLI.runCmd(paychAddFundsCmd, cmd)
}() }()
// Wait for the output to stop being "Channel does not exist" // Wait for the output to stop being "Channel does not exist"
@ -344,10 +344,10 @@ func TestPaymentChannelVoucherCreateShortfall(t *testing.T) {
mockCLI := newMockCLI(t) mockCLI := newMockCLI(t)
creatorCLI := mockCLI.client(paymentCreator.ListenAddr) creatorCLI := mockCLI.client(paymentCreator.ListenAddr)
// creator: paych get <creator> <receiver> <amount> // creator: paych add-funds <creator> <receiver> <amount>
channelAmt := 100 channelAmt := 100
cmd := []string{creatorAddr.String(), receiverAddr.String(), fmt.Sprintf("%d", channelAmt)} cmd := []string{creatorAddr.String(), receiverAddr.String(), fmt.Sprintf("%d", channelAmt)}
chstr := creatorCLI.runCmd(paychGetCmd, cmd) chstr := creatorCLI.runCmd(paychAddFundsCmd, cmd)
chAddr, err := address.NewFromString(chstr) chAddr, err := address.NewFromString(chstr)
require.NoError(t, err) require.NoError(t, err)

View File

@ -217,16 +217,11 @@ func capGasFee(msg *types.Message, maxFee abi.TokenAmount) {
gl := types.NewInt(uint64(msg.GasLimit)) gl := types.NewInt(uint64(msg.GasLimit))
totalFee := types.BigMul(msg.GasFeeCap, gl) totalFee := types.BigMul(msg.GasFeeCap, gl)
minerFee := types.BigMul(msg.GasPremium, gl)
if totalFee.LessThanEqual(maxFee) { if totalFee.LessThanEqual(maxFee) {
return return
} }
// scale chain/miner fee down proportionally to fit in our budget
// TODO: there are probably smarter things we can do here to optimize
// message inclusion latency
msg.GasFeeCap = big.Div(maxFee, gl) msg.GasFeeCap = big.Div(maxFee, gl)
msg.GasPremium = big.Div(big.Div(big.Mul(minerFee, maxFee), totalFee), gl) msg.GasPremium = big.Min(msg.GasFeeCap, msg.GasPremium) // cap premium at FeeCap
} }