Skip to content

Commit

Permalink
Merge pull request #4408 from filecoin-project/feat/better-gas-defaults
Browse files Browse the repository at this point in the history
Improve gas defaults
  • Loading branch information
magik6k authored Oct 15, 2020
2 parents 7e5b1ac + 698b49b commit 958f169
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 3 additions & 1 deletion chain/messagepool/messagepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ var MaxUntrustedActorPendingMessages = 10

var MaxNonceGap = uint64(4)

var DefaultMaxFee = abi.TokenAmount(types.MustParseFIL("0.007"))

var (
ErrMessageTooBig = errors.New("message too big")

Expand Down Expand Up @@ -183,7 +185,7 @@ func ComputeMinRBF(curPrem abi.TokenAmount) abi.TokenAmount {

func CapGasFee(msg *types.Message, maxFee abi.TokenAmount) {
if maxFee.Equals(big.Zero()) {
maxFee = types.NewInt(build.FilecoinPrecision / 10)
maxFee = DefaultMaxFee
}

gl := types.NewInt(uint64(msg.GasLimit))
Expand Down
9 changes: 9 additions & 0 deletions chain/types/fil.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,14 @@ func ParseFIL(s string) (FIL, error) {
return FIL{r.Num()}, nil
}

func MustParseFIL(s string) FIL {
n, err := ParseFIL(s)
if err != nil {
panic(err)
}

return n
}

var _ encoding.TextMarshaler = (*FIL)(nil)
var _ encoding.TextUnmarshaler = (*FIL)(nil)
10 changes: 5 additions & 5 deletions node/config/def.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ func DefaultStorageMiner() *StorageMiner {
},

Fees: MinerFeeConfig{
MaxPreCommitGasFee: types.FIL(types.BigDiv(types.FromFil(1), types.NewInt(20))), // 0.05
MaxCommitGasFee: types.FIL(types.BigDiv(types.FromFil(1), types.NewInt(20))),
MaxWindowPoStGasFee: types.FIL(types.FromFil(50)),
MaxPublishDealsFee: types.FIL(types.BigDiv(types.FromFil(1), types.NewInt(33))), // 0.03ish
MaxMarketBalanceAddFee: types.FIL(types.BigDiv(types.FromFil(1), types.NewInt(100))), // 0.01
MaxPreCommitGasFee: types.MustParseFIL("0.025"),
MaxCommitGasFee: types.MustParseFIL("0.05"),
MaxWindowPoStGasFee: types.MustParseFIL("5"),
MaxPublishDealsFee: types.MustParseFIL("0.05"),
MaxMarketBalanceAddFee: types.MustParseFIL("0.007"),
},
}
cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"
Expand Down

0 comments on commit 958f169

Please sign in to comment.