github.com/KYVENetwork/cometbft/v38@v38.0.3/spec/consensus/wal.md (about) 1 --- 2 order: 6 3 --- 4 # WAL 5 6 Consensus module writes every message to the WAL (write-ahead log). 7 8 It also issues fsync syscall through 9 [File#Sync](https://golang.org/pkg/os/#File.Sync) for messages signed by this 10 node (to prevent double signing). 11 12 Under the hood, it uses 13 [autofile.Group](https://github.com/KYVENetwork/cometbft/v38/blob/af3bc47df982e271d4d340a3c5e0d773e440466d/libs/autofile/group.go#L54), 14 which rotates files when those get too big (> 10MB). 15 16 The total maximum size is 1GB. We only need the latest block and the block before it, 17 but if the former is dragging on across many rounds, we want all those rounds. 18 19 ## Replay 20 21 Consensus module will replay all the messages of the last height written to WAL 22 before a crash (if such occurs). 23 24 The private validator may try to sign messages during replay because it runs 25 somewhat autonomously and does not know about replay process. 26 27 For example, if we got all the way to precommit in the WAL and then crash, 28 after we replay the proposal message, the private validator will try to sign a 29 prevote. But it will fail. That's ok because we’ll see the prevote later in the 30 WAL. Then it will go to precommit, and that time it will work because the 31 private validator contains the `LastSignBytes` and then we’ll replay the 32 precommit from the WAL. 33 34 Make sure to read about [WAL corruption](https://github.com/KYVENetwork/cometbft/v38/blob/v0.38.x/docs/core/running-in-production.md#wal-corruption) 35 and recovery strategies.