Skip to content

Commit

Permalink
Merge pull request #418 from anoma/yuji/prune-tm-blocks
Browse files Browse the repository at this point in the history
CometPrune guide to prune CometBFT blocks
  • Loading branch information
brentstone authored Jan 2, 2025
2 parents 0e9451d + 6e7db9b commit 33af832
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/docs/pages/operators/ledger/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"env-vars": "Node Configuration",
"running-a-full-node": "Full node step-by-step",
"logging-config": "Logging configurations",
"base-directory": "Base directory"
}
"base-directory": "Base directory",
"pruning-cometbft-blocks": "Pruning CometBFT blocks"
}
33 changes: 33 additions & 0 deletions packages/docs/pages/operators/ledger/pruning-cometbft-blocks.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Callout } from 'nextra-theme-docs'

# Pruning CometBFT blocks

The size of the CometBFT directory will grow with validator signatures, transactions, etc.

The tool [CometPrune](https://github.com/ekhvalov/cometprune) can prune old blocks from your CometBFT directory.
It reduces only the CometBFT data in `${BASE_DIR}/${CHAIN_ID}/cometbft` and does not affect Namada's storage data in `${BASE_DIR}/${CHAIN_ID}/db`.

### Install CometPrune
- Download the binary from [the release page](https://github.com/ekhvalov/cometprune/releases)

- Or, build from the source
```shell copy
git clone [email protected]:ekhvalov/cometprune.git
cd cometprune
go install
```

### Prune the blocks
1. Stop the node

2. Prune the blocks
```shell copy
cometprune --path ${BASE_DIR}/${CHAIN_ID}/cometbft/data --keep-blocks $BLOCKS_TO_KEEP
```
where the most recent `$BLOCKS_TO_KEEP` will be retained.

<Callout>
Leaving the last one block (`--keep-blocks 1`) is enough to restart the node successfully. The tool will reject to delete all blocks, i.e. `--keep-blocks 0` doesn't work.
</Callout>

3. Restart the node

0 comments on commit 33af832

Please sign in to comment.