From 76fcc47b5232b9228442c20ea4978f45666c624c Mon Sep 17 00:00:00 2001 From: millken Date: Mon, 20 Nov 2023 14:01:41 +0800 Subject: [PATCH] use default gasprice when gasprice==0 --- action/protocol/execution/evm/evm.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/action/protocol/execution/evm/evm.go b/action/protocol/execution/evm/evm.go index 824d40da8e..bba0f638f9 100644 --- a/action/protocol/execution/evm/evm.go +++ b/action/protocol/execution/evm/evm.go @@ -29,6 +29,7 @@ import ( "github.com/iotexproject/iotex-core/blockchain/genesis" "github.com/iotexproject/iotex-core/pkg/log" "github.com/iotexproject/iotex-core/pkg/tracer" + "github.com/iotexproject/iotex-core/pkg/unit" "github.com/iotexproject/iotex-core/pkg/util/byteutil" ) @@ -279,6 +280,10 @@ func ExecuteContract( sharedGas uint64 sharedGasFee, totalGasFee *big.Int ) + // if gas price is zero, set it to smallest unit + if ps.txCtx.GasPrice.Sign() == 0 { + ps.txCtx.GasPrice = big.NewInt(unit.Qev) + } if ps.featureCtx.SharedGasWithDapp && sgd != nil { // TODO: sgd is whether nil should be checked in processSGD receiver, sharedGas, err = processSGD(ctx, sm, execution, consumedGas, sgd)