Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CometPrune guide to prune CometBFT blocks #418

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading