Skip to content

Conversation

@martintomazic
Copy link
Contributor

@martintomazic martintomazic commented Jan 18, 2026

We had this bug ever since, just nobody noticed.

If you set runtime with pruning and genesis sync, first thing will be the runtime light history created by indexing consensus data. Light history is needed to fetch corresponding runtime state. To prevent too early pruning of light history, prune handlers don't allow to prune it past last synced round.

Unfortunately, if the runtime state DB is empty, worker.GetLastSynced() returns defaultUndefinedRound that equals to max uint64, effectively allowing to prune anything. This removes early light history, and the node is then later (once consensus is synced) stuck at checkpoint sync, as there is no corresponding light block to verify the genesis checkpoint against.

Also noticed pruning with default parameters is set to 64 rounds every 2 minutes. With #6355 merged, we might want to bump the defaults...

@netlify
Copy link

netlify bot commented Jan 18, 2026

Deploy Preview for oasisprotocol-oasis-core canceled.

Name Link
🔨 Latest commit be877f2
🔍 Latest deploy log https://app.netlify.com/projects/oasisprotocol-oasis-core/deploys/69722fa826d6030007cdb84a

@peternose
Copy link
Collaborator

Looks good and makes sense.

Copy link
Member

@kostko kostko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, this makes sense!

In case of empty state DB, last synced round is set to max uint64
value, thus the worker prunes light history even if it should not do it.
@martintomazic martintomazic force-pushed the martin/fix/storage-committee-prune-handler branch from c446561 to be877f2 Compare January 22, 2026 14:09
@martintomazic martintomazic marked this pull request as ready for review January 22, 2026 14:10
@martintomazic martintomazic merged commit 9fd474e into master Jan 22, 2026
5 checks passed
@martintomazic martintomazic deleted the martin/fix/storage-committee-prune-handler branch January 22, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants