Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ping-ke committed Aug 22, 2024
1 parent fd5d2ee commit a246cce
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cmd/integration-test-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethstorage/go-ethstorage/cmd/es-utils/utils"
"github.com/ethstorage/go-ethstorage/ethstorage"
es "github.com/ethstorage/go-ethstorage/ethstorage"
"github.com/ethstorage/go-ethstorage/ethstorage/node"
Expand Down Expand Up @@ -187,6 +188,7 @@ func verifyData() error {
defer file.Close()

fileScanner := bufio.NewScanner(file)
fileScanner.Buffer(make([]byte, dataSize*2), kvSize*2)
fileScanner.Split(bufio.ScanLines)

df, err := es.OpenDataFile(shardFile)
Expand All @@ -200,16 +202,17 @@ func verifyData() error {
i := uint64(0)
for fileScanner.Scan() {
expectedData := common.Hex2Bytes(fileScanner.Text())
root, _ := prover.GetRoot(expectedData, 1, kvSize)
commit := generateMetadata(root)
data, err := ds.Read(i, dataSize, commit)
blobs := utils.EncodeBlobs(expectedData)
commit, _ := ds.ReadMeta(i)
data, err := ds.Read(i, kvSize, common.BytesToHash(commit))
if err != nil {
return errors.New(fmt.Sprintf("read %d from shard fail with err: %s", i, err.Error()))
}
if bytes.Compare(expectedData, data) != 0 {
if bytes.Compare(blobs[0][:], data) != 0 {
return errors.New(fmt.Sprintf("compare data %d fail, expected data %s; data: %s",
i, common.Bytes2Hex(expectedData[:256]), common.Bytes2Hex(data[:256])))
i, common.Bytes2Hex(blobs[0][:256]), common.Bytes2Hex(data[:256])))
}
i++
}
return nil
}
Expand Down

0 comments on commit a246cce

Please sign in to comment.