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

Commit 2d8edbd

Browse files
authored
Eliminate unnecessary RPC calls during bundler runs (#303)
1 parent 918ed58 commit 2d8edbd

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

pkg/bundler/bundler.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ func (i *Bundler) Process(ep common.Address) (*modules.BatchHandlerCtx, error) {
118118
WithValues("entrypoint", ep.String()).
119119
WithValues("chain_id", i.chainID.String())
120120

121+
// Get all pending userOps from the mempool. This will be in FIFO order. Downstream modules should sort it
122+
// based on more specific strategies.
123+
batch, err := i.mempool.Dump(ep)
124+
if err != nil {
125+
l.Error(err, "bundler run error")
126+
return nil, err
127+
}
128+
if len(batch) == 0 {
129+
return nil, nil
130+
}
131+
batch = adjustBatchSize(i.maxBatch, batch)
132+
121133
// Get current block basefee
122134
bf, err := i.gbf()
123135
if err != nil {
@@ -142,18 +154,6 @@ func (i *Bundler) Process(ep common.Address) (*modules.BatchHandlerCtx, error) {
142154
return nil, err
143155
}
144156

145-
// Get all pending userOps from the mempool. This will be in FIFO order. Downstream modules should sort it
146-
// based on more specific strategies.
147-
batch, err := i.mempool.Dump(ep)
148-
if err != nil {
149-
l.Error(err, "bundler run error")
150-
return nil, err
151-
}
152-
if len(batch) == 0 {
153-
return nil, nil
154-
}
155-
batch = adjustBatchSize(i.maxBatch, batch)
156-
157157
// Create context and execute modules.
158158
ctx := modules.NewBatchHandlerContext(batch, ep, i.chainID, bf, gt, gp)
159159
if err := i.batchHandler(ctx); err != nil {

0 commit comments

Comments
 (0)