Skip to content

[build] Remove rocksdb support in favor of defaulting to pebble db backend #2432

Description

@Unique-Divine

Nibiru runtime already defaults to PebbleDB; Heart Monitor reads chain data through the Pebble Go API. This issue finishes removing leftover RocksDB and grocksdb build and module baggage from the monorepo—the migration started in #1818, #1908, and #1979.

Root file go.mod and file lib/sai-trading/go.mod carry a tracked TODO pointing here. The work is build and dependency cleanup, not a runtime backend switch.

Runtime and indexer are already on Pebble

Component Today
Node default constant DefaultDBBackend = db.PebbleDBBackend in file app/appconst/appconst.go
Binary default ldflag -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb in build script contrib/scripts/build-nibiru.sh
Tests build tag pebbledb in file contrib/make/test.mk and recipe justfile test paths
Heart Monitor function pebble.Open read-only on {CHAIN_DB_PATH}/blockstore.db and state.db (nibi-go-hm/services/chaindb.go); Rocks branches panic

Heart Monitor does not parse Pebble SST internals. It uses the Pebble client Get with CometBFT application keys (H:{height}, P:{height}:{index}, abciResponsesKey:{height}) and protobuf-decodes values—see files nibi-go-hm/services/blocks_tracker.go and nibi-go-hm/services/events_tracker/events_processor.go.

Why Pebble over Rocks for Nibiru

  • Same on-disk layout the node writes when config key db_backend=pebbledb — Heart Monitor is aligned.
  • Simpler builds: drop target ensure_rocksdb_lib in script contrib/scripts/build-nibiru.sh (wget librocksdb.a v8.9.1), CGO -lrocksdb, and Linux dev packages (lz4, snappy, bz2, zstd, …) from the build path.
  • Cosmos direction: Pebble is the maintained path; Rocks is legacy ballast in the Makefile/module graph.
  • Operational note: Rocks via module grocksdb is CGo + C++; known upstream leak/OOM reports exist (rocksdb#4313, rocksdb#13645). Pebble is not leak-free either (pebble#1588) but matches the default backend and avoids shipping unused Rocks linkage in every nibid build.

What still drags Rocks in today

  • Function build_tags_for_os in script contrib/scripts/build-nibiru.sh includes build tags rocksdb and pebbledb; the build path calls function ensure_rocksdb_lib before compile.
  • Command go mod why → module cometbft/cometbft-db → module linxGnu/grocksdb (unconditional module require, even when only Pebble is used).
  • Replace pin for module grocksdb in root file go.mod, file lib/sai-trading/go.mod, and test contrib/go_mod_replace_test.go.

Safety preconditions

  • No runtime backend flip — Pebble is already default; this removes unused build/deps.
  • Indexer already Pebble-only — Heart Monitor Rocks code paths panic; no production HM dependency on grocksdb for chain reads.
  • Tests already Pebble-tagged — CI/local test paths use build tag -tags=pebbledb only.
  • Ops confirmation: any mainnet/archive nodes still on config db_backend=rocksdb? Confirm with ops before merge. If any remain, document migration (re-sync or explicit backend change) in PR/release notes—not a blocker for build cleanup if all managed nodes are on Pebble.

Implementation checklist

nibi-chain — build

  • Remove build tag rocksdb from function build_tags_for_os in script contrib/scripts/build-nibiru.sh
  • Delete function ensure_rocksdb_lib and Rocks CGO flags (CGO_CFLAGS / CGO_LDFLAGS, Darwin -lrocksdb)
  • Update build/install targets so they no longer depend on Rocks artifacts
  • Verify file Dockerfile make build / just build still succeeds without Rocks artifacts

nibi-chain — modules

  • Remove module github.com/linxGnu/grocksdb replace and indirect dep from root file go.mod (and file lib/sai-trading/go.mod if still synced)
  • Update test file contrib/go_mod_replace_test.go — drop grocksdb from required replaces
  • Resolve module cometbft-db still pulling grocksdb (bump/fork cometbft-db if needed so module graph is clean without Rocks build tag)
  • Run command go mod tidy and fix any transitive fallout under directories lib/cosmos-sdk/ / lib/wasmvm/ if required

nibi-chain — docs / comments

  • Refresh stale Rocks mentions: file gosdk/README.md, comment in file app/upgrades/v1.go, file LEGACY-CHANGELOG.md (optional)

nibi-go-hm (heart-monitor) — follow-up (same PR or follow-on)

  • Remove dead else { // Rocksdb } panic branches in file services/chaindb.go
  • Fix README: replace “Rocks DB” / go test -tags rocksdb with Pebble-only instructions
  • Drop unused module grocksdb from file go.mod once the nibiru dependency graph no longer pulls it

Verification

  • command just build on Linux (and Darwin if applicable)
  • command just test-fast / test recipes with build tag -tags=pebbledb
  • Smoke: local node starts with default config; Heart Monitor historical read from CHAIN_DB_PATH still works against Pebble blockstore.db / state.db

References

  • CHANGELOG: #1818 Pebble support, #1908 Pebble default, #1979 integration tests
  • Geth upgrade note (Pebble dep): CHANGELOG v1.14 / module cockroach/pebble
  • Heart Monitor Pebble fork: replace github.com/NibiruChain/pebble in file nibi-go-hm/go.mod

Metadata

Metadata

Assignees

Labels

S-implStatus: Implementation-ready. Clear and fully specificedS-triageStatus: This issue is waiting on initial triage. More Info: https://tinyurl.com/25uty9w5

Type

No type

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions