Skip to content

Commit

Permalink
feat: add api to simulate gasless bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
irrun committed Jul 17, 2024
1 parent c34d9d5 commit 556493d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
3 changes: 0 additions & 3 deletions core/types/bundle_gasless.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package types

import (
"math/big"

"github.com/ethereum/go-ethereum/common/hexutil"
)

Expand All @@ -13,7 +11,6 @@ type SimulateGaslessBundleArgs struct {
type GaslessTx struct {
Index int
GasUsed uint64
GasFee *big.Int
}

type SimulateGaslessBundleResp struct {
Expand Down
19 changes: 0 additions & 19 deletions miner/worker_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,28 +516,9 @@ func (w *worker) simulateGaslessBundle(env *environment, bundle *types.Bundle) (
continue
}

effectiveTip, er := tx.EffectiveGasTip(env.header.BaseFee)
if er != nil {
return nil, er
}

gasPrice := big.NewInt(effectiveTip.Int64())
if env.header.BaseFee != nil {
log.Info("simulate bundle: header base fee", "value", env.header.BaseFee.String())
gasPrice.Add(gasPrice, env.header.BaseFee)
}

gasFee := new(big.Int).Mul(new(big.Int).SetUint64(receipt.GasUsed), gasPrice)

if tx.Type() == types.BlobTxType {
blobFee := new(big.Int).Mul(new(big.Int).SetUint64(receipt.BlobGasUsed), receipt.BlobGasPrice)
gasFee.Add(gasFee, blobFee)
}

validTxs = append(validTxs, types.GaslessTx{
Index: i,
GasUsed: receipt.GasUsed,
GasFee: gasFee,
})

txIndx++
Expand Down

0 comments on commit 556493d

Please sign in to comment.