Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(taiko-client): use customize error #18777

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/taiko-client/pkg/chain_iterator/block_batch_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"io"
"math/big"
"time"

Expand All @@ -23,6 +22,7 @@ const (
)

var (
errEOF = errors.New("EOF")
davidtaikocha marked this conversation as resolved.
Show resolved Hide resolved
errContinue = errors.New("continue")
)

Expand Down Expand Up @@ -143,7 +143,7 @@ func (i *BlockBatchIterator) Iter() error {
break
}
if err := i.iter(); err != nil {
if errors.Is(err, io.EOF) {
if errors.Is(err, errEOF) {
log.Debug(
"Block batch iterator finished",
"start", i.startHeight,
Expand Down Expand Up @@ -205,7 +205,7 @@ func (i *BlockBatchIterator) iter() (err error) {
}

if i.current.Number.Uint64() >= destHeight {
return io.EOF
return errEOF
}

endHeight = i.current.Number.Uint64() + i.blocksReadPerEpoch
Expand All @@ -226,7 +226,7 @@ func (i *BlockBatchIterator) iter() (err error) {
}

if i.isEnd {
return io.EOF
return errEOF
}

i.current = endHeader
Expand All @@ -235,7 +235,7 @@ func (i *BlockBatchIterator) iter() (err error) {
return errContinue
}

return io.EOF
return errEOF
}

// updateCurrent updates the iterator's current cursor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package chainiterator

import (
"context"
"io"
"math/big"
"testing"
"time"
Expand Down Expand Up @@ -110,7 +109,7 @@ func (s *BlockBatchIteratorTestSuite) TestIterWithLessThanConfirmations() {
})

s.Nil(err)
s.Equal(io.EOF, iter.iter())
s.Equal(errEOF, iter.iter())
s.Equal(headHeight, lastEnd)
}

Expand Down
Loading