Merge pull request #2456 from filecoin-project/feat/increase-cron-gas

Increase cron gas
This commit is contained in:
Jakub Sztandera 2020-07-17 20:11:21 +02:00 committed by GitHub
commit 1b5797be9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import (
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/vm" "github.com/filecoin-project/lotus/chain/vm"
@ -25,7 +26,7 @@ func (sm *StateManager) CallRaw(ctx context.Context, msg *types.Message, bstate
} }
if msg.GasLimit == 0 { if msg.GasLimit == 0 {
msg.GasLimit = 10000000000 msg.GasLimit = build.BlockGasLimit
} }
if msg.GasPrice == types.EmptyInt { if msg.GasPrice == types.EmptyInt {
msg.GasPrice = types.NewInt(0) msg.GasPrice = types.NewInt(0)

View File

@ -8,6 +8,7 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
amt "github.com/filecoin-project/go-amt-ipld/v2" amt "github.com/filecoin-project/go-amt-ipld/v2"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/state" "github.com/filecoin-project/lotus/chain/state"
"github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/store"
@ -236,7 +237,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, pstate cid.Cid, bms []B
Nonce: ca.Nonce, Nonce: ca.Nonce,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPrice: types.NewInt(0), GasPrice: types.NewInt(0),
GasLimit: 1 << 30, // Make super sure this is never too little GasLimit: build.BlockGasLimit * 10, // Make super sure this is never too little
Method: builtin.MethodsCron.EpochTick, Method: builtin.MethodsCron.EpochTick,
Params: nil, Params: nil,
} }

View File

@ -550,7 +550,8 @@ func (rt *Runtime) chargeGasInternal(gas GasCharge, skip int) aerrors.ActorError
rt.lastGasChargeTime = now rt.lastGasChargeTime = now
rt.lastGasCharge = &gasTrace rt.lastGasCharge = &gasTrace
if rt.gasUsed+toUse > rt.gasAvailable { // overflow safe
if rt.gasUsed > rt.gasAvailable-toUse {
rt.gasUsed = rt.gasAvailable rt.gasUsed = rt.gasAvailable
return aerrors.Newf(exitcode.SysErrOutOfGas, "not enough gas: used=%d, available=%d", return aerrors.Newf(exitcode.SysErrOutOfGas, "not enough gas: used=%d, available=%d",
rt.gasUsed, rt.gasAvailable) rt.gasUsed, rt.gasAvailable)