From 10a9327371e840110bedf4d00be5a5e875a85515 Mon Sep 17 00:00:00 2001 From: MSevey <15232757+MSevey@users.noreply.github.com> Date: Tue, 19 Nov 2024 16:03:36 -0500 Subject: [PATCH 1/2] feat: add reset-state guide --- .vitepress/config.ts | 4 ++ guides/reset-state.md | 107 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 guides/reset-state.md diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 88bbd690d..aef003d39 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -330,6 +330,10 @@ function sidebarHome() { text: "Restart your rollup", link: "/guides/restart-rollup", }, + { + text: "Reset your chain's state", + link: "/guides/reset-state", + }, { text: "Run a rollup full node", link: "/guides/full-node", diff --git a/guides/reset-state.md b/guides/reset-state.md new file mode 100644 index 000000000..e05612ea1 --- /dev/null +++ b/guides/reset-state.md @@ -0,0 +1,107 @@ +# How to reset the state of your chain + +This guide will walk you through how you reset the state of your chain. + +:::warning Disclaimer +By definition, reseting the state is deleting your chain's data. Make sure you understand the implications of this prior to completion this guide. +::: + +Some reason you might need to reset the state of your chain are: +* During testing and development +* During upgrades with breaking changes +* Hardforks + +## Prerequisities + +In order to complete this guide, you will need to have completed either the [quick start tutorial](/tutorials/quick-start.md) or the [build our chain tutorial](/tutorials/wordle.md). + +## Quick Start + +When you run your chain with `rollkit start` you will create a `.rollkit` directory in your root directory. + +This directory will look like the following. + +```bash +tree $HOME/.rollkit + +├── config +│   ├── config.toml +│   ├── genesis.json +│   ├── node_key.json +│   └── priv_validator_key.json +└── data + ├── priv_validator_state.json + └── rollkit + ├── 000001.sst + ├── 000001.vlog + ├── 000002.sst + ├── 000002.vlog + ├── DISCARD + ├── KEYREGISTRY + └── MANIFEST +``` + +To reset the state of the chain, delete the entire `.rollkit` directory. + +```bash +rm -rf $HOME/.rollkit +``` + +When you launch your chain again with `rollkit start` your `.rollkit` directory will be re-created and you will see your chain starting at block height 1 again. + +## Wordle + +When you ran your wordle chain in the [build your chain turtorial](/tutorials/wordle.md), it created a `.wordle` directory. + +This directory will look like the following: + +```bash +tree $HOME/.wordle + +├── config +│   ├── app.toml +│   ├── client.toml +│   ├── config.toml +│   ├── genesis.json +│   ├── gentx +│   │   └── gentx-6e46bd1f53acead98b43e63fcf2bd5435499350d.json +│   ├── node_key.json +│   └── priv_validator_key.json +├── data +│   ├── application.db +│   │   ├── 000001.log +│   │   ├── CURRENT +│   │   ├── LOCK +│   │   ├── LOG +│   │   └── MANIFEST-000000 +│   ├── priv_validator_state.json +│   ├── rollkit +│   │   ├── 000001.sst +│   │   ├── 000001.vlog +│   │   ├── DISCARD +│   │   ├── KEYREGISTRY +│   │   └── MANIFEST +│   └── snapshots +│   └── metadata.db +│   ├── 000001.log +│   ├── CURRENT +│   ├── LOCK +│   ├── LOG +│   └── MANIFEST-000000 +└── keyring-test + ├── 4a90e750914792c2d7f98775c13a588d9d304bd0.address + ├── 53dab037ac3bd380f4a9192b2c6eedbe95fce180.address + ├── alice.info + └── bob.info +``` + +The directories you need to delete to reset your state are in the `.wordle/data` directory. + +```bash +rm -rf \ + $HOME/.wordle/data/application.db \ + $HOME/.wordle/data/rollkit \ + $HOME/.wordle/data/snapshots +``` + +When you launch your chain again with your `rollkit start ` command, these data directories will be re-created and you will see your chain starting at block height 1 again. From 386f2b3f4be58914368e657ae0ec79cbe7912781 Mon Sep 17 00:00:00 2001 From: MSevey <15232757+MSevey@users.noreply.github.com> Date: Tue, 19 Nov 2024 16:21:47 -0500 Subject: [PATCH 2/2] chore: use rollkit tendermint unsafe-reset-all instead of rm -rf --- guides/reset-state.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/guides/reset-state.md b/guides/reset-state.md index e05612ea1..04d07dc10 100644 --- a/guides/reset-state.md +++ b/guides/reset-state.md @@ -98,10 +98,15 @@ tree $HOME/.wordle The directories you need to delete to reset your state are in the `.wordle/data` directory. ```bash -rm -rf \ - $HOME/.wordle/data/application.db \ - $HOME/.wordle/data/rollkit \ - $HOME/.wordle/data/snapshots +$HOME/.wordle/data/application.db +$HOME/.wordle/data/rollkit +$HOME/.wordle/data/snapshots +``` + +You can delete them with the following command: + +```bash +rollkit tendermint unsafe-reset-all ``` When you launch your chain again with your `rollkit start ` command, these data directories will be re-created and you will see your chain starting at block height 1 again.