Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(op-geth): add new field in SimulateGaslessBundleResp #205

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions core/types/bundle_gasless.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type GaslessTxSimResult struct {
}

type SimulateGaslessBundleResp struct {
ValidResults []GaslessTxSimResult
BasedBlockNumber int64
ValidResults []GaslessTxSimResult
GasReachedResults []GaslessTxSimResult
BasedBlockNumber int64
}
15 changes: 10 additions & 5 deletions miner/worker_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,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 {
Expand All @@ -455,19 +456,23 @@ func (w *worker) simulateGaslessBundle(env *environment, bundle *types.Bundle) (
if err != nil {
env.state.RevertToSnapshot(snap)
env.gasPool.SetGas(gp)
log.Info("fail to simulate gasless bundle, skipped", "txHash", tx.Hash(), "err", err)
log.Error("fail to simulate gasless bundle, skipped", "txHash", 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,
})
}
}

return &types.SimulateGaslessBundleResp{
ValidResults: result,
BasedBlockNumber: env.header.Number.Int64(),
ValidResults: validResults,
GasReachedResults: gasReachedResults,
BasedBlockNumber: env.header.Number.Int64(),
}, nil
}

Expand Down
Loading