Skip to content

Commit

Permalink
Bug fix edge case locating entry (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpunish3r authored Oct 23, 2023
1 parent 31d1b73 commit a43bb01
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,13 @@ Stream relay server included in the datastream library allows scaling the number
## DATASTREAM CLI DEMO APP
Build the binary datastream demo app (`dsdemo`):
```
$ make build
make build
```
Run the app without parameters to see the available commands:
```
$ ./dsdemo
./dsdemo
```
```
NAME:
dsdemo - Run a datastream server/client/relay demo cli app
Expand All @@ -161,7 +163,9 @@ GLOBAL OPTIONS:
### SERVER
Use the help option to check available parameters for the server command:
```
$ ./dsdemo help server
./dsdemo help server
```
```
NAME:
dsdemo server - Run datastream server
Expand All @@ -178,16 +182,18 @@ OPTIONS:
```
Run a datastream server with default parameters (port: `6900`, file: `datastream.bin`, log: `info`):
```
$ ./dsdemo server
./dsdemo server
```
Or run a datastream server with custom parameters:
```
$ ./dsdemo server --port 6969 --file seqstream.bin --log warn
./dsdemo server --port 6969 --file seqstream.bin --log warn
```
### CLIENT
Use the help option to check available parameters for the client command:
```
$ ./dsdemo help client
./dsdemo help client
```
```
NAME:
dsdemo client - Run datastream client
Expand All @@ -203,11 +209,11 @@ OPTIONS:
```
Run a datastream client with default parameters (server: `127.0.0.1:6900`, from: `latest`, log: `info`)
```
$ ./dsdemo client
./dsdemo client
```
Or run a datastream client with custom parameters:
```
$ ./dsdemo client --server 127.0.0.1:6969 --from 0 --log debug
./dsdemo client --server 127.0.0.1:6969 --from 0 --log debug
```

## USE CASE: zkEVM SEQUENCER ENTRIES
Expand Down
8 changes: 7 additions & 1 deletion datastreamer/streamfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,13 @@ func (f *StreamFile) getFirstEntryOnNextPage(iterator *iteratorFile) (uint64, er
}

// Check if exists another data page
forward := pageDataSize - (curpos-pageHeaderSize)%pageDataSize
var forward int64
if (curpos-pageHeaderSize)%pageDataSize == 0 {
forward = 0
} else {
forward = pageDataSize - (curpos-pageHeaderSize)%pageDataSize
}

if curpos+forward >= int64(f.writtenHead.TotalLength) {
return math.MaxUint64, nil
}
Expand Down

0 comments on commit a43bb01

Please sign in to comment.