Skip to content

Problem: non-empty data get cleared during restoration from versiondb #1801

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* [#1779](https://github.com/crypto-org-chain/cronos/pull/1779) Upgrade rocksdb to `v9.11.2`.

### Bug Fixes

* [#1801](https://github.com/crypto-org-chain/cronos/pull/1801) Avoid non-empty data from being cleared during restoration from versiondb.

*Apr 9, 2025*

## v1.4.6
Expand Down
1 change: 1 addition & 0 deletions integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ def test_local_statesync(cronos, tmp_path_factory):
wait_for_new_blocks(cli, 2)
# check grpc works
print("distribution", cli.distribution_community(height=height))
print("balances", cli.balances(cli0.address("validator")))
with pytest.raises(Exception) as exc_info:
cli.distribution_community(height=height - 1)

Expand Down
10 changes: 6 additions & 4 deletions versiondb/client/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@
return fmt.Errorf("node height %v cannot exceed %v",
item.IAVL.Height, math.MaxInt8)
}
ch <- versiondb.ImportEntry{
StoreKey: storeKey,
Key: item.IAVL.Key,
Value: item.IAVL.Value,
if len(item.IAVL.Value) > 0 {
ch <- versiondb.ImportEntry{
StoreKey: storeKey,
Key: item.IAVL.Key,
Value: item.IAVL.Value,
}

Check warning on line 115 in versiondb/client/restore.go

View check run for this annotation

Codecov / codecov/patch

versiondb/client/restore.go#L110-L115

Added lines #L110 - L115 were not covered by tests
}
default:
break loop
Expand Down
Loading