Skip to content

Commit

Permalink
feat: adds more tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
ckartik committed May 30, 2024
1 parent 3754635 commit f97680c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions consensus/clique/clique.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion eth/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}

Expand Down
12 changes: 10 additions & 2 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit f97680c

Please sign in to comment.