Skip to content

Commit

Permalink
add 1 or else we duplicate the end/start block
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey committed Mar 14, 2024
1 parent 6c0d98f commit 810a5c7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/blobstorage/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (i *Indexer) filter(ctx context.Context) error {
"batchsize", defaultBlockBatchSize,
)

for j := i.latestIndexedBlockNumber + 1; j <= endBlockID; j += defaultBlockBatchSize {
for j := i.latestIndexedBlockNumber + 1; j <= endBlockID; j += defaultBlockBatchSize + 1 {
// if the end of the batch is greater than the latest block number, set end
// to the latest block number
end := utils.Min(j+defaultBlockBatchSize, endBlockID)
Expand Down Expand Up @@ -246,7 +246,7 @@ func calculateBlobHash(commitmentStr string) common.Hash {
&commitment,
)

return common.Hash(blobHash[:])
return common.BytesToHash(blobHash[:])
}

func (i *Indexer) checkReorg(ctx context.Context, event *taikol1.TaikoL1BlockProposed) error {
Expand Down Expand Up @@ -292,7 +292,7 @@ func (i *Indexer) storeBlob(ctx context.Context, event *taikol1.TaikoL1BlockProp
for _, data := range responseData.Data {
data.KzgCommitmentHex = common.FromHex(data.KzgCommitment)

metaBlobHash := common.Hash(event.Meta.BlobHash[:])
metaBlobHash := common.BytesToHash(event.Meta.BlobHash[:])
// Comparing the hex strings of meta.blobHash (blobHash)
if calculateBlobHash(data.KzgCommitment) == metaBlobHash {
blockTs, err := i.getBlockTimestamp(i.cfg.RPCURL, new(big.Int).SetUint64(blockID))
Expand Down

0 comments on commit 810a5c7

Please sign in to comment.