Skip to content

Commit

Permalink
Merge pull request #330 from bnb-chain/develop
Browse files Browse the repository at this point in the history
release: prepare for the release v0.26.0
  • Loading branch information
unclezoro authored Mar 20, 2023
2 parents d3ff7da + 69fd243 commit 259050b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

##v0.26.0
* [sec] [\#328](https://github.com/bnb-chain/bnc-cosmos-sdk/pull/328) sec: implement security enhancements (#328)

##v0.25.9

* [sdk] [\#300](https://github.com/bnb-chain/bnc-cosmos-sdk/pull/300) feats: add ics23 proof support
Expand Down
9 changes: 9 additions & 0 deletions store/statesync_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ func (helper *StateSyncHelper) WriteRecoveryChunk(hash abci.SHA256Sum, chunk *ab
if chunk != nil {
numOfNodes := len(chunk.Nodes)
nodes := make([]*iavl.Node, 0, numOfNodes)

if numOfNodes == 0 {
return fmt.Errorf("length of nodes is 0")
}

helper.logger.Info("start write recovery chunk", "isComplete", isComplete, "hash", fmt.Sprintf("%x", hash), "startIdx", chunk.StartIdx, "numOfNodes", numOfNodes, "chunkCompletion", chunk.Completeness)

Expand All @@ -200,6 +204,7 @@ func (helper *StateSyncHelper) WriteRecoveryChunk(hash abci.SHA256Sum, chunk *ab
return err
}
}

nodeIdx := chunk.StartIdx + int64(numOfNodes-1)
helper.incompleteChunks[nodeIdx] = append(helper.incompleteChunks[nodeIdx],
incompleteChunkItem{
Expand Down Expand Up @@ -277,6 +282,10 @@ func (helper *StateSyncHelper) saveIncompleteChunks() error {
// sort and check chunkItems are valid
sort.Sort(&chunkItemSorter{chunkItems})

if len(chunkItems) == 0 {
return fmt.Errorf("length of chunks is 0")
}

expectedNodeParts := chunkItems[len(chunkItems)-1].chunkIdx - chunkItems[0].chunkIdx + 1
if expectedNodeParts != len(chunkItems) {
return fmt.Errorf("node parts are not complete, should be %d, but have %d, nodeIdx: %d", expectedNodeParts, len(chunkItems), nodeIdx)
Expand Down
2 changes: 1 addition & 1 deletion types/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (key *KVStoreKey) String() string {
// range query for all []byte with a certain prefix
// Deals with last byte of prefix being FF without overflowing
func PrefixEndBytes(prefix []byte) []byte {
if prefix == nil {
if len(prefix) == 0 {
return nil
}

Expand Down

0 comments on commit 259050b

Please sign in to comment.