diff --git a/core/types/bundle_gasless.go b/core/types/bundle_gasless.go index 3be28ebf1e..22cbe799bb 100644 --- a/core/types/bundle_gasless.go +++ b/core/types/bundle_gasless.go @@ -15,6 +15,7 @@ type GaslessTxSimResult struct { } type SimulateGaslessBundleResp struct { - ValidResults []GaslessTxSimResult - BasedBlockNumber int64 + ValidResults []GaslessTxSimResult + GasReachedResults []GaslessTxSimResult + BasedBlockNumber int64 } diff --git a/miner/worker_builder.go b/miner/worker_builder.go index e8d0d7711f..3d17abf27c 100644 --- a/miner/worker_builder.go +++ b/miner/worker_builder.go @@ -503,7 +503,8 @@ func (w *worker) simulateBundle( } func (w *worker) simulateGaslessBundle(env *environment, bundle *types.Bundle) (*types.SimulateGaslessBundleResp, error) { - result := make([]types.GaslessTxSimResult, 0) + validResults := make([]types.GaslessTxSimResult, 0) + gasReachedResults := make([]types.GaslessTxSimResult, 0) txIdx := 0 for _, tx := range bundle.Txs { @@ -520,10 +521,14 @@ func (w *worker) simulateGaslessBundle(env *environment, bundle *types.Bundle) ( env.state.RevertToSnapshot(snap) env.gasPool.SetGas(gp) log.Error("fail to simulate gasless tx, skipped", "hash", tx.Hash(), "err", err) + + if err == core.ErrGasLimitReached { + gasReachedResults = append(gasReachedResults, types.GaslessTxSimResult{Hash: tx.Hash()}) + } } else { txIdx++ - result = append(result, types.GaslessTxSimResult{ + validResults = append(validResults, types.GaslessTxSimResult{ Hash: tx.Hash(), GasUsed: receipt.GasUsed, }) @@ -531,8 +536,9 @@ func (w *worker) simulateGaslessBundle(env *environment, bundle *types.Bundle) ( } return &types.SimulateGaslessBundleResp{ - ValidResults: result, - BasedBlockNumber: env.header.Number.Int64(), + ValidResults: validResults, + GasReachedResults: gasReachedResults, + BasedBlockNumber: env.header.Number.Int64(), }, nil }