[Bug]: Wrong calculation of allowed pruning height when changing snapshot-interval
#23638
Open
1 task done
Labels
Is there an existing issue for this?
What happened?
There are wrong calculations of the allowed pruning height when a node operator changes the
snapshot-interval
from one value (A) to a larger value (B). This issue can cause two problems:pruneSnapshotHeights[0] + snapshotInterval - 1
. However, this assumption fails when the snapshot interval is changed, potentially deleting a snapshot that is still being processed.snapshot-interval
= 10 andpruning-keep-recent
= "5", so the node creates a snapshot at block 10.snapshot-interval
to 20.pruning-keep-recent
. The state at height 20 will be deleted and it causes issues on the snapshot If the snapshot at block 20 is not fully finished yet.pruneSnapshotHeights
if the next snapshot is atpreviousSnapshotHeight + snapshotInterval
.snapshot-interval
= 10.pruneSnapshotHeights
= [10].snapshot-interval
to 20.pruneSnapshotHeights
= [10, 20].pruneSnapshotHeights[1]
) is not equal to 10 (pruneSnapshotHeights[0]
) + 20 (snapshotInterval
)pruneSnapshotHeights
= [10, 20, 40].pruneSnapshotHeights
remains [10, 20, 40, …], but pruning only happens up topruneSnapshotHeights[0] + snapshotInterval - 1
= 29 (pruning stops at block 29) The node never prunes blocks beyond height 29, leading to unexpected storage growth.Cosmos SDK Version
v0.50+ with store v1
How to reproduce?
simd
from Cosmos SDK v0.50.11~/.simapp/config/app.toml
)snapshot-interval
inapp.toml
to 20.The text was updated successfully, but these errors were encountered: