From f97680c0cb17895e289927813826f9332e6e13cf Mon Sep 17 00:00:00 2001 From: Kartik Chopra Date: Thu, 30 May 2024 17:45:29 -0400 Subject: [PATCH] feat: adds more tracing --- consensus/clique/clique.go | 3 +++ eth/api_backend.go | 2 +- miner/worker.go | 12 ++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index ecf5be129ccf..47ac815e8590 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -636,6 +636,9 @@ func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, res if c.config.PeriodMs == 0 && len(block.Transactions()) == 0 { return errors.New("sealing paused while waiting for transactions") } + for _, tx := range block.Transactions() { + log.Info("Processing transaction at consensus layer", "tx_hash", tx.Hash().Hex()) + } // Don't hold the signer fields for the entire sealing procedure c.lock.RLock() signer, signFn := c.signer, c.signFn diff --git a/eth/api_backend.go b/eth/api_backend.go index b0625eec2472..35da87c74653 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -290,7 +290,7 @@ func (b *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscri // SendTx sends a signed transaction to the transaction pool. func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error { - log.Info("Sending transaction", "tx_hash", signedTx.Hash().Hex()) + log.Info("transaction entering mempool", "tx_hash", signedTx.Hash().Hex()) return b.eth.txPool.Add([]*types.Transaction{signedTx}, true, false)[0] } diff --git a/miner/worker.go b/miner/worker.go index 65baa9ff54ce..563d52a2ff11 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -545,10 +545,12 @@ func (w *worker) mainLoop() { if !w.isRunning() && w.current != nil { // If block is already full, abort if gp := w.current.gasPool; gp != nil && gp.Gas() < params.TxGas { + log.Info("Gas pool is full, skipping transaction", "gas", gp.Gas()) continue } txs := make(map[common.Address][]*txpool.LazyTransaction, len(ev.Txs)) for _, tx := range ev.Txs { + log.Info("Adding transaction to pending block", "tx_hash", tx.Hash().Hex()) acc, _ := types.Sender(w.current.signer, tx) txs[acc] = append(txs[acc], &txpool.LazyTransaction{ Pool: w.eth.TxPool(), // We don't know where this came from, yolo resolve from everywhere @@ -795,7 +797,7 @@ func (w *worker) applyTransaction(env *environment, tx *types.Transaction) (*typ snap = env.state.Snapshot() gp = env.gasPool.Gas() ) - log.Info("Applying transaction", "tx_hash", tx.Hash(), "coinbase", env.coinbase, "gas_available", gp) + log.Info("executing transaction on node", "tx_hash", tx.Hash(), "coinbase", env.coinbase, "gas_available", gp) receipt, err := core.ApplyTransaction(w.chainConfig, w.chain, &env.coinbase, env.gasPool, env.state, env.header, tx, &env.header.GasUsed, *w.chain.GetVMConfig()) if err != nil { log.Error("Transaction application failed", "tx_hash", tx.Hash(), "error", err) @@ -1009,7 +1011,13 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) { func (w *worker) fillTransactions(interrupt *atomic.Int32, env *environment) error { pending := w.eth.TxPool().Pending(true) log.Info("Pending transactions retrieved in fillTransactions", "count", len(pending)) - + for _, batch := range pending { + for _, tx := range batch { + if tx != nil { + log.Info("filltransactions pulling out of mempool", "tx_hash", tx.Hash.String()) + } + } + } // Split the pending transactions into locals and remotes. localTxs, remoteTxs := make(map[common.Address][]*txpool.LazyTransaction), pending for _, account := range w.eth.TxPool().Locals() {