Skip to content

Commit

Permalink
do not write batches to the stream with a missing fork id (erigontech…
Browse files Browse the repository at this point in the history
  • Loading branch information
hexoscott authored Jun 13, 2024
1 parent 6847aeb commit 894bc3b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions zk/datastream/server/data_stream_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,11 @@ func (srv *DataStreamServer) CreateStreamEntriesProto(
entryCount += 2

// a gap of 1 is normal but if greater than we need to account for the empty batches which will each
// have a batch bookmark, batch start and batch end - but only if we're operating pre-etrog
// have a batch bookmark, batch start and batch end - but only if we're operating pre-etrog and the
// fork exists (i.e. not 0)
for i := lastBatchNumber + 1; i < batchNumber; i++ {
if batchesToForks[i] < EtrogBatchNumber {
fork := batchesToForks[i]
if fork != 0 && fork < EtrogBatchNumber {
entryCount += 3
}
}
Expand All @@ -261,9 +263,11 @@ func (srv *DataStreamServer) CreateStreamEntriesProto(
workingBatch := lastBatchNumber + uint64(i)

// check the fork of the batch being skipped - if it is etrog+ then we can skip this
// as we don't want empty batches there
// as we don't want empty batches there - a 0 fork here would indicate that the batch
// was not in the parent stream (bad batch) so we want to skip it in our own production
// of the stream
workingFork := batchesToForks[workingBatch]
if workingFork >= EtrogBatchNumber {
if workingFork == 0 || workingFork >= EtrogBatchNumber {
continue
}

Expand Down

0 comments on commit 894bc3b

Please sign in to comment.