Commit 249d9e78 authored by Tei Im's avatar Tei Im

batches_test refactoring

Support log based test for batch validation rules
Add more test cases for span batch
parent 96a24cc3
...@@ -199,11 +199,11 @@ func checkSpanBatch(ctx context.Context, cfg *rollup.Config, log log.Logger, l1B ...@@ -199,11 +199,11 @@ func checkSpanBatch(ctx context.Context, cfg *rollup.Config, log log.Logger, l1B
if batch.GetTimestamp() < nextTimestamp { if batch.GetTimestamp() < nextTimestamp {
if batch.GetTimestamp() > l2SafeHead.Time { if batch.GetTimestamp() > l2SafeHead.Time {
// batch timestamp cannot be between safe head and next timestamp // batch timestamp cannot be between safe head and next timestamp
log.Warn("batch has misaligned timestamp") log.Warn("batch has misaligned timestamp, block time is too short")
return BatchDrop return BatchDrop
} }
if (l2SafeHead.Time-batch.GetTimestamp())%cfg.BlockTime != 0 { if (l2SafeHead.Time-batch.GetTimestamp())%cfg.BlockTime != 0 {
log.Warn("batch has misaligned timestamp") log.Warn("batch has misaligned timestamp, not overlapped exactly")
return BatchDrop return BatchDrop
} }
parentNum = l2SafeHead.Number - (l2SafeHead.Time-batch.GetTimestamp())/cfg.BlockTime - 1 parentNum = l2SafeHead.Number - (l2SafeHead.Time-batch.GetTimestamp())/cfg.BlockTime - 1
......
This diff is collapsed.
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