Skip to content

Commit

Permalink
Started adding better logging (ethereum#231)
Browse files Browse the repository at this point in the history
* Started adding better logging

* Fix issues with existing logs

* logs: better logs

Co-authored-by: Mark Tyneway <[email protected]>
  • Loading branch information
smartcontracts and tynes authored Mar 2, 2021
1 parent bfa3007 commit a923663
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ func (w *worker) mainLoop() {
continue
}
tx := ev.Txs[0]
log.Debug("Attempting to commit rollup transaction", "hash", tx.Hash().Hex())
if err := w.commitNewTx(tx); err == nil {
head := <-w.chainHeadCh
txs := head.Block.Transactions()
Expand Down Expand Up @@ -1064,8 +1065,12 @@ func (w *worker) commit(uncles []*types.Header, interval func(), update bool, st
return fmt.Errorf("Block created with not %d transactions at %d", len(txs), block.NumberU64())
}
tx := txs[0]
log.Info("New block", "index", block.Number().Uint64()-uint64(1), "timestamp", block.Time(), "tx-hash", tx.Hash().Hex(),
"gas", block.GasUsed(), "fees", feesEth, "elapsed", common.PrettyDuration(time.Since(start)))
bn := tx.L1BlockNumber()
if bn == nil {
bn = new(big.Int)
}
log.Info("New block", "index", block.Number().Uint64()-uint64(1), "l1-timestamp", tx.L1Timestamp(), "l1-blocknumber", bn.Uint64(), "tx-hash", tx.Hash().Hex(),
"queue-orign", tx.QueueOrigin(), "type", tx.SignatureHashType(), "gas", block.GasUsed(), "fees", feesEth, "elapsed", common.PrettyDuration(time.Since(start)))

case <-w.exitCh:
log.Info("Worker has exited")
Expand Down
2 changes: 2 additions & 0 deletions rollup/sync_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ func (s *SyncService) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Sub
// inspecting the local database. This is mean to prevent transactions from
// being replayed.
func (s *SyncService) maybeApplyTransaction(tx *types.Transaction) error {
log.Debug("Maybe applying transaction", "hash", tx.Hash().Hex())
index := tx.GetMeta().Index
if index == nil {
return fmt.Errorf("nil index in maybeApplyTransaction")
Expand Down Expand Up @@ -605,6 +606,7 @@ func (s *SyncService) applyTransaction(tx *types.Transaction) error {
// queue origin sequencer transactions, as the contracts on L1 manage the same
// validity checks that are done here.
func (s *SyncService) ApplyTransaction(tx *types.Transaction) error {
log.Debug("Sending transaction to sync service", "hash", tx.Hash().Hex())
s.txLock.Lock()
defer s.txLock.Unlock()
if s.verifier {
Expand Down

0 comments on commit a923663

Please sign in to comment.