8

I upgraded a chain that uses Grandpa/Aura with code for instant seal by mistake. I believe it may be possible to revert some blocks:

https://github.com/paritytech/substrate/pull/1479

But cannot find any documentation on how to do this. It is also asked here: How to unbrick a Substrate Chain? --revert?

But no answer for how to use --revert is given.

2 Answers 2

10

You can use the revert command to revert unfinalized blocks. If you need to revert finalized blocks then I suggest you do the following:

  • Assuming you want to revert to block #42;
  • Add the hash of block #43 to the chain spec under badBlocks (example: https://raw.githubusercontent.com/paritytech/polkadot/a4931d93388688af2e39e1aca77a6dcefd4bbd10/node/service/chain-specs/kusama.json);
  • Sync a node from scratch and it should stop importing blocks after #42 (since #43 is blacklisted it will fail to import);
  • You can now deploy this database to other validators and they should start authoring (and finalizing on top of #42). Alternatively you can also just resync using the new chain spec;
  • Since you are reverting finality all clients on the network will need to resync (using the new chainspec with badBlocks populated).
1
  • If this answered your question you should consider accepting the response :)
    – André
    Commented Mar 18, 2022 at 16:52
5

I figured out how to revert some blocks:

./{chain executable} revert --base-path /home/ubuntu/chains --chain {chain name}--keep-blocks 351284 --pruning archive

For options:

./{chain executable} revert --help
1
  • 2
    Did it work? AFAIK this only reverts un-finalized blocks. Commented Feb 17, 2022 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.