paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK

Home Page:https://polkadot.network/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support changing/downgrading state pruning mode

nazar-pc opened this issue · comments

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Motivation

State pruning modes can be seen as subsets of each other. For example archive-canonical is a subset of archive, while constrained to a number of blocks can be a subset of both archive-canonical and archive. Even constrained pruning with 10k blocks is a subset of constrained pruning with 100k blocks.

Unfortunately right now node will refuse to start if pruning mode is different from what it was when database was created originally, even though technically it should be possible to downgrade from one of the pruning modes to its subset.

While current behavior generally makes sense for Substrate CLI, when Substrate is used as a library it might be desired to be able to change pruning modes over time. Our Subspace protocol didn't support pruning of some kinds originally, but then evolved to support it, but we're stuck with large state databases for existing users due to lack of upgrade to more constrained versions of it.

Request

Support changing/downgrading of pruning modes like this:

  • archive -> archive-canonical
  • archive-canonical -> archive
  • archive or archive-canonical -> number
  • number -> lower number

Solution

No response

Are you willing to help with this request?

Maybe (please elaborate above)

  • number -> lower number

This is already supported.

For the other ones, it makes sense and we should also support them.