@@ -37,6 +37,7 @@ import (
3737 "github.com/ethereum/go-ethereum/eth/tracers/logger"
3838 "github.com/ethereum/go-ethereum/event"
3939 "github.com/ethereum/go-ethereum/log"
40+ "github.com/ethereum/go-ethereum/metrics"
4041 "github.com/ethereum/go-ethereum/params"
4142 "github.com/ethereum/go-ethereum/trie"
4243)
@@ -1396,7 +1397,11 @@ func (w *worker) fillTransactionsAlgoWorker(interrupt *int32, env *environment)
13961397 }
13971398
13981399 builder := newGreedyBuilder (w .chain , w .chainConfig , w .blockList , env , interrupt )
1400+ start := time .Now ()
13991401 newEnv , blockBundles := builder .buildBlock (bundlesToConsider , pending )
1402+ if metrics .EnabledBuilder {
1403+ mergeAlgoTimer .Update (time .Since (start ))
1404+ }
14001405 * env = * newEnv
14011406
14021407 return nil , blockBundles , bundlesToConsider
@@ -1679,17 +1684,37 @@ func (w *worker) simulateBundles(env *environment, bundles []types.MevBundle, pe
16791684 wg .Add (1 )
16801685 go func (idx int , bundle types.MevBundle , state * state.StateDB ) {
16811686 defer wg .Done ()
1687+
1688+ start := time .Now ()
1689+ if metrics .EnabledBuilder {
1690+ bundleTxNumHistogram .Update (int64 (len (bundle .Txs )))
1691+ }
1692+
16821693 if len (bundle .Txs ) == 0 {
16831694 return
16841695 }
16851696 gasPool := new (core.GasPool ).AddGas (env .header .GasLimit )
16861697 simmed , err := w .computeBundleGas (env , bundle , state , gasPool , pendingTxs , 0 )
16871698
1699+ if metrics .EnabledBuilder {
1700+ simulationMeter .Mark (1 )
1701+ }
1702+
16881703 if err != nil {
1704+ if metrics .EnabledBuilder {
1705+ simulationRevertedMeter .Mark (1 )
1706+ failedBundleSimulationTimer .UpdateSince (start )
1707+ }
1708+
16891709 log .Trace ("Error computing gas for a bundle" , "error" , err )
16901710 return
16911711 }
16921712 simResult [idx ] = & simmed
1713+
1714+ if metrics .EnabledBuilder {
1715+ simulationCommittedMeter .Mark (1 )
1716+ successfulBundleSimulationTimer .UpdateSince (start )
1717+ }
16931718 }(i , bundle , env .state .Copy ())
16941719 }
16951720
@@ -1705,6 +1730,9 @@ func (w *worker) simulateBundles(env *environment, bundles []types.MevBundle, pe
17051730 }
17061731
17071732 log .Debug ("Simulated bundles" , "block" , env .header .Number , "allBundles" , len (bundles ), "okBundles" , len (simulatedBundles ), "time" , time .Since (start ))
1733+ if metrics .EnabledBuilder {
1734+ blockBundleSimulationTimer .Update (time .Since (start ))
1735+ }
17081736 return simulatedBundles , nil
17091737}
17101738
0 commit comments