diff --git a/core/types/bundle_gasless.go b/core/types/bundle_gasless.go index 2ffcefe7ef..3be28ebf1e 100644 --- a/core/types/bundle_gasless.go +++ b/core/types/bundle_gasless.go @@ -12,10 +12,9 @@ type SimulateGaslessBundleArgs struct { type GaslessTxSimResult struct { Hash common.Hash GasUsed uint64 - Valid bool } type SimulateGaslessBundleResp struct { - Results []GaslessTxSimResult + ValidResults []GaslessTxSimResult BasedBlockNumber int64 } diff --git a/internal/ethapi/api_bundle.go b/internal/ethapi/api_bundle.go index f5aae60d6c..9dfd72c3d8 100644 --- a/internal/ethapi/api_bundle.go +++ b/internal/ethapi/api_bundle.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/log" ) const InvalidBundleParamError = -38000 @@ -36,7 +37,8 @@ func (s *PrivateTxBundleAPI) SimulateGaslessBundle(_ context.Context, args types for _, encodedTx := range args.Txs { tx := new(types.Transaction) if err := tx.UnmarshalBinary(encodedTx); err != nil { - return nil, err + log.Error("failed to unmarshal gasless tx", "err", err) + continue } txs = append(txs, tx) } diff --git a/miner/worker_builder.go b/miner/worker_builder.go index 8aa1641b33..8e26af0928 100644 --- a/miner/worker_builder.go +++ b/miner/worker_builder.go @@ -503,9 +503,8 @@ func (w *worker) simulateGaslessBundle(env *environment, bundle *types.Bundle) ( env.state.SetTxContext(tx.Hash(), txIdx) var ( - snap = env.state.Snapshot() - gp = env.gasPool.Gas() - valid = true + snap = env.state.Snapshot() + gp = env.gasPool.Gas() ) receipt, err := core.ApplyTransaction(w.chainConfig, w.chain, &w.coinbase, env.gasPool, env.state, env.header, tx, @@ -513,21 +512,19 @@ func (w *worker) simulateGaslessBundle(env *environment, bundle *types.Bundle) ( if err != nil { env.state.RevertToSnapshot(snap) env.gasPool.SetGas(gp) - valid = false - log.Warn("fail to simulate gasless bundle, skipped", "txHash", tx.Hash(), "err", err) + log.Error("fail to simulate gasless tx, skipped", "hash", tx.Hash(), "err", err) } else { txIdx++ - } - result = append(result, types.GaslessTxSimResult{ - Hash: tx.Hash(), - GasUsed: receipt.GasUsed, - Valid: valid, - }) + result = append(result, types.GaslessTxSimResult{ + Hash: tx.Hash(), + GasUsed: receipt.GasUsed, + }) + } } return &types.SimulateGaslessBundleResp{ - Results: result, + ValidResults: result, BasedBlockNumber: env.header.Number.Int64(), }, nil }