Skip to content

Commit

Permalink
Logs pt 3 (ethereum#38)
Browse files Browse the repository at this point in the history
* log more info about bundles for all algos
* remove redundant build block log
* make fetch logs debug
  • Loading branch information
dvush authored and avalonche committed Feb 6, 2023
1 parent 4beddf1 commit c2582cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions builder/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ func (r *RemoteRelay) updateValidatorsMap(currentSlot uint64, retries int) error
r.lastRequestedSlot = currentSlot
r.validatorsLock.Unlock()

log.Info("Updated validators", "new", newMap, "for slot", currentSlot)

log.Info("Updated validators", "count", len(newMap), "slot", currentSlot)
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions flashbotsextra/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (b *bundleFetcher) fetchAndPush(ctx context.Context, pushMevBundles func(bu
log.Error("failed to fetch high prio bundles", "err", err)
continue
}
log.Info("Fetching High prio bundles", "size", len(bundles), "currentlyBuiltBlockNum", currentBlockNum+1)
log.Debug("Fetching High prio bundles", "size", len(bundles), "currentlyBuiltBlockNum", currentBlockNum+1)
if len(bundles) != 0 {
pushMevBundles(bundles)
}
Expand All @@ -105,7 +105,7 @@ func (b *bundleFetcher) fetchAndPush(ctx context.Context, pushMevBundles func(bu
log.Error("failed to fetch low prio bundles", "err", err)
continue
}
log.Info("Fetching low prio bundles", "len", len(bundles), "currentlyBuiltBlockNum", currentBlockNum+1)
log.Debug("Fetching low prio bundles", "len", len(bundles), "currentlyBuiltBlockNum", currentBlockNum+1)
if len(bundles) != 0 {
pushMevBundles(bundles)
}
Expand Down
10 changes: 4 additions & 6 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1432,9 +1432,7 @@ func (w *worker) fillTransactionsAlgoWorker(interrupt *int32, env *environment,
return err, nil
}

start := time.Now()
simBundles, err := w.simulateBundles(env, bundles, nil) /* do not consider gas impact of mempool txs as bundles are treated as transactions wrt ordering */
log.Debug("Simulated bundles", "time", time.Since(start), "bundles", len(bundles))
if err != nil {
log.Error("Failed to simulate flashbots bundles", "err", err)
return err, nil
Expand All @@ -1443,10 +1441,8 @@ func (w *worker) fillTransactionsAlgoWorker(interrupt *int32, env *environment,
bundlesToConsider = simBundles
}

start := time.Now()
builder := newGreedyBuilder(w.chain, w.chainConfig, w.blockList, env, interrupt)
newEnv, blockBundles := builder.buildBlock(bundlesToConsider, pending)
log.Debug("Build block", "time", time.Since(start), "gasUsed", newEnv.header.GasUsed)
*env = *newEnv

if validatorCoinbase != nil && w.config.BuilderTxSigningKey != nil {
Expand Down Expand Up @@ -1498,7 +1494,6 @@ func (w *worker) generateWork(params *generateParams) (*types.Block, *big.Int, e
if errors.Is(err, errBlockInterruptedByTimeout) {
log.Warn("Block building is interrupted", "allowance", common.PrettyDuration(w.newpayloadTimeout))
}
log.Debug("Filled block with transactions", "time", time.Since(start), "gas used", work.header.GasUsed, "txs", len(work.txs))
}
block, err := w.engine.FinalizeAndAssemble(w.chain, work.header, work.state, work.txs, work.unclelist(), work.receipts, params.withdrawals)
if err != nil {
Expand Down Expand Up @@ -1722,6 +1717,7 @@ func (w *worker) mergeBundles(env *environment, bundles []simulatedBundle, pendi
}

func (w *worker) simulateBundles(env *environment, bundles []types.MevBundle, pendingTxs map[common.Address]types.Transactions) ([]simulatedBundle, error) {
start := time.Now()
headerHash := env.header.Hash()
simCache := w.flashbots.bundleCache.GetBundleCache(headerHash)

Expand All @@ -1744,7 +1740,7 @@ func (w *worker) simulateBundles(env *environment, bundles []types.MevBundle, pe
simmed, err := w.computeBundleGas(env, bundle, state, gasPool, pendingTxs, 0)

if err != nil {
log.Debug("Error computing gas for a bundle", "error", err)
log.Trace("Error computing gas for a bundle", "error", err)
return
}
simResult[idx] = &simmed
Expand All @@ -1762,6 +1758,8 @@ func (w *worker) simulateBundles(env *environment, bundles []types.MevBundle, pe
}
}

okBundles := len(bundles) - len(simulatedBundles)
log.Debug("Simulated bundles", "block", env.header.Number, "allBundles", len(bundles), "okBundles", okBundles, "time", time.Since(start))
return simulatedBundles, nil
}

Expand Down

0 comments on commit c2582cc

Please sign in to comment.