I hit an unclean shutdown issue today with Badger DB used for slashing protection:
{"level":"info","service":"rules","impl":"standard","store":"badger","time":"2025-08-26T10:01:38.931Z","message":"All 3 tables opened in 358ms"}
{"level":"info","service":"rules","impl":"standard","store":"badger","time":"2025-08-26T10:01:38.941Z","message":"Replaying file id: 2 at offset: 538031502"}
{"level":"warn","service":"rules","impl":"standard","store":"badger","time":"2025-08-26T10:01:39.710Z","message":"Truncate Needed. File /dirk-protection//000002.vlog size: 593431212 Endoffset: 564236262"}
That made Dirk panic and refuse to start.
From my understanding, that's the write ahead log being partially written before the transaction is committed. It looks as if the process died in the middle of writing that log (withSyncWrites is true by default).
To deal with corrupted logs, I suggest to add withTruncate(true) to the default options inside rules/standard/storage.go. That should deal with that problem automatically. I believe that this is a safe option.
I hit an unclean shutdown issue today with Badger DB used for slashing protection:
That made Dirk panic and refuse to start.
From my understanding, that's the write ahead log being partially written before the transaction is committed. It looks as if the process died in the middle of writing that log (withSyncWrites is true by default).
To deal with corrupted logs, I suggest to add
withTruncate(true)to the default options inside rules/standard/storage.go. That should deal with that problem automatically. I believe that this is a safe option.