This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Description
I think we may need to exclude the removed user operation from consideration for next estimation loop.
file /pkg/modules/relay/relayer.go :
// SendUserOperation returns a BatchHandler that is used by the Bundler to send batches in a regular EOA
// transaction.
func (r *Relayer) SendUserOperation() modules.BatchHandlerFunc {
return func(ctx *modules.BatchHandlerCtx) error {
opts := transaction.Opts{
EOA: r.eoa,
Eth: r.eth,
ChainID: ctx.ChainID,
EntryPoint: ctx.EntryPoint,
Batch: ctx.Batch,
Beneficiary: r.beneficiary,
BaseFee: ctx.BaseFee,
Tip: ctx.Tip,
GasPrice: ctx.GasPrice,
GasLimit: 0,
WaitTimeout: r.waitTimeout,
}
// Estimate gas for handleOps() and drop all userOps that cause unexpected reverts.
estRev := []string{}
for len(ctx.Batch) > 0 {
est, revert, err := transaction.EstimateHandleOpsGas(&opts)
if err != nil {
return err
} else if revert != nil {
ctx.MarkOpIndexForRemoval(revert.OpIndex)
estRev = append(estRev, revert.Reason)
// Exclude the removed user operation from consideration for next estimation loop.
opts.Batch = ctx.Batch
} else {
opts.GasLimit = est
break
}
}
ctx.Data["estimate_revert_reasons"] = estRev
...
}
}```