Commit 08b96e2f authored by Joshua Gutow's avatar Joshua Gutow

op-node: More logging

parent 60129ad5
...@@ -139,6 +139,7 @@ func (bq *BatchQueue) AddBatch(batch *BatchData, l2SafeHead eth.L2BlockRef) { ...@@ -139,6 +139,7 @@ func (bq *BatchQueue) AddBatch(batch *BatchData, l2SafeHead eth.L2BlockRef) {
if validity == BatchDrop { if validity == BatchDrop {
return // if we do drop the batch, CheckBatch will log the drop reason with WARN level. return // if we do drop the batch, CheckBatch will log the drop reason with WARN level.
} }
bq.log.Debug("Adding batch", "batch_timestamp", batch.Timestamp, "parent_hash", batch.ParentHash, "batch_epoch", batch.Epoch(), "txs", len(batch.Transactions))
bq.batches[batch.Timestamp] = append(bq.batches[batch.Timestamp], &data) bq.batches[batch.Timestamp] = append(bq.batches[batch.Timestamp], &data)
} }
...@@ -212,7 +213,7 @@ batchLoop: ...@@ -212,7 +213,7 @@ batchLoop:
if nextBatch.Batch.EpochNum == rollup.Epoch(epoch.Number)+1 { if nextBatch.Batch.EpochNum == rollup.Epoch(epoch.Number)+1 {
bq.l1Blocks = bq.l1Blocks[1:] bq.l1Blocks = bq.l1Blocks[1:]
} }
bq.log.Trace("Returning found batch", "epoch", epoch, "batch_epoch", nextBatch.Batch.EpochNum, "batch_timestamp", nextBatch.Batch.Timestamp) bq.log.Info("Found next batch", "epoch", epoch, "batch_epoch", nextBatch.Batch.EpochNum, "batch_timestamp", nextBatch.Batch.Timestamp)
return nextBatch.Batch, nil return nextBatch.Batch, nil
} }
...@@ -241,7 +242,7 @@ batchLoop: ...@@ -241,7 +242,7 @@ batchLoop:
// to preserve that L2 time >= L1 time. If this is the first block of the epoch, always generate a // to preserve that L2 time >= L1 time. If this is the first block of the epoch, always generate a
// batch to ensure that we at least have one batch per epoch. // batch to ensure that we at least have one batch per epoch.
if nextTimestamp < nextEpoch.Time || firstOfEpoch { if nextTimestamp < nextEpoch.Time || firstOfEpoch {
bq.log.Trace("Generating next batch", "epoch", epoch, "timestamp", nextTimestamp) bq.log.Info("Generating next batch", "epoch", epoch, "timestamp", nextTimestamp)
return &BatchData{ return &BatchData{
BatchV1{ BatchV1{
ParentHash: l2SafeHead.Hash, ParentHash: l2SafeHead.Hash,
......
...@@ -69,6 +69,7 @@ func (cb *ChannelBank) prune() { ...@@ -69,6 +69,7 @@ func (cb *ChannelBank) prune() {
ch := cb.channels[id] ch := cb.channels[id]
cb.channelQueue = cb.channelQueue[1:] cb.channelQueue = cb.channelQueue[1:]
delete(cb.channels, id) delete(cb.channels, id)
cb.log.Info("pruning channel", "channel", id, "totalSize", totalSize, "channel_size", ch.size, "remaining_channel_count", len(cb.channels))
totalSize -= ch.size totalSize -= ch.size
} }
} }
...@@ -86,6 +87,7 @@ func (cb *ChannelBank) IngestFrame(f Frame) { ...@@ -86,6 +87,7 @@ func (cb *ChannelBank) IngestFrame(f Frame) {
currentCh = NewChannel(f.ID, origin) currentCh = NewChannel(f.ID, origin)
cb.channels[f.ID] = currentCh cb.channels[f.ID] = currentCh
cb.channelQueue = append(cb.channelQueue, f.ID) cb.channelQueue = append(cb.channelQueue, f.ID)
log.Info("created new channel")
} }
// check if the channel is not timed out // check if the channel is not timed out
...@@ -114,7 +116,7 @@ func (cb *ChannelBank) Read() (data []byte, err error) { ...@@ -114,7 +116,7 @@ func (cb *ChannelBank) Read() (data []byte, err error) {
ch := cb.channels[first] ch := cb.channels[first]
timedOut := ch.OpenBlockNumber()+cb.cfg.ChannelTimeout < cb.Origin().Number timedOut := ch.OpenBlockNumber()+cb.cfg.ChannelTimeout < cb.Origin().Number
if timedOut { if timedOut {
cb.log.Debug("channel timed out", "channel", first, "frames", len(ch.inputs)) cb.log.Info("channel timed out", "channel", first, "frames", len(ch.inputs))
delete(cb.channels, first) delete(cb.channels, first)
cb.channelQueue = cb.channelQueue[1:] cb.channelQueue = cb.channelQueue[1:]
return nil, nil // multiple different channels may all be timed out return nil, nil // multiple different channels may all be timed out
...@@ -137,7 +139,6 @@ func (cb *ChannelBank) Read() (data []byte, err error) { ...@@ -137,7 +139,6 @@ func (cb *ChannelBank) Read() (data []byte, err error) {
// consistency around channel bank pruning which depends upon the order // consistency around channel bank pruning which depends upon the order
// of operations. // of operations.
func (cb *ChannelBank) NextData(ctx context.Context) ([]byte, error) { func (cb *ChannelBank) NextData(ctx context.Context) ([]byte, error) {
// Do the read from the channel bank first // Do the read from the channel bank first
data, err := cb.Read() data, err := cb.Read()
if err == io.EOF { if err == io.EOF {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment