Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve gas defaults #4408

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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