From 87d436b3f07786fc661e657a9fd80232dce309fd Mon Sep 17 00:00:00 2001 From: millken Date: Tue, 21 Nov 2023 16:30:46 +0800 Subject: [PATCH] fix ps.helperCtx.DepositGasFunc == nil --- action/protocol/execution/evm/evm.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/action/protocol/execution/evm/evm.go b/action/protocol/execution/evm/evm.go index 824d40da8e..9977b4c1ca 100644 --- a/action/protocol/execution/evm/evm.go +++ b/action/protocol/execution/evm/evm.go @@ -278,6 +278,7 @@ func ExecuteContract( receiver address.Address sharedGas uint64 sharedGasFee, totalGasFee *big.Int + depositGasFunc DepositGasWithSGD ) if ps.featureCtx.SharedGasWithDapp && sgd != nil { // TODO: sgd is whether nil should be checked in processSGD @@ -291,7 +292,14 @@ func ExecuteContract( sharedGasFee.Mul(sharedGasFee, ps.txCtx.GasPrice) } totalGasFee = new(big.Int).Mul(new(big.Int).SetUint64(consumedGas), ps.txCtx.GasPrice) - depositLog, err = ps.helperCtx.DepositGasFunc(ctx, sm, receiver, totalGasFee, sharedGasFee) + if ps.helperCtx.DepositGasFunc == nil { + depositGasFunc = func(ctx context.Context, sm protocol.StateManager, a address.Address, i1, i2 *big.Int) (*action.TransactionLog, error) { + return nil, nil + } + } else { + depositGasFunc = ps.helperCtx.DepositGasFunc + } + depositLog, err = depositGasFunc(ctx, sm, receiver, totalGasFee, sharedGasFee) if err != nil { return nil, nil, err }