diff --git a/gno.land/pkg/integration/testing_node.go b/gno.land/pkg/integration/testing_node.go index 139e79ed1ba..106c5b14bb8 100644 --- a/gno.land/pkg/integration/testing_node.go +++ b/gno.land/pkg/integration/testing_node.go @@ -147,6 +147,7 @@ func DefaultTestingTMConfig(gnoroot string) *tmcfg.Config { const defaultListner = "tcp://127.0.0.1:0" tmconfig := tmcfg.TestConfig().SetRootDir(gnoroot) + tmconfig.Consensus.WALDisabled = true tmconfig.Consensus.CreateEmptyBlocks = true tmconfig.Consensus.CreateEmptyBlocksInterval = time.Duration(0) tmconfig.RPC.ListenAddress = defaultListner diff --git a/tm2/pkg/bft/consensus/config/config.go b/tm2/pkg/bft/consensus/config/config.go index dbd4ffc6364..cda4c63ae28 100644 --- a/tm2/pkg/bft/consensus/config/config.go +++ b/tm2/pkg/bft/consensus/config/config.go @@ -16,9 +16,10 @@ const ( // ConsensusConfig defines the configuration for the Tendermint consensus service, // including timeouts and details about the WAL and the block structure. type ConsensusConfig struct { - RootDir string `toml:"home"` - WalPath string `toml:"wal_file"` - walFile string // overrides WalPath if set + RootDir string `toml:"home"` + WALPath string `toml:"wal_file"` + WALDisabled bool `toml:"-"` + walFile string // overrides WalPath if set TimeoutPropose time.Duration `toml:"timeout_propose"` TimeoutProposeDelta time.Duration `toml:"timeout_propose_delta"` @@ -43,7 +44,7 @@ type ConsensusConfig struct { // DefaultConsensusConfig returns a default configuration for the consensus service func DefaultConsensusConfig() *ConsensusConfig { return &ConsensusConfig{ - WalPath: filepath.Join(defaultDataDir, "cs.wal", "wal"), + WALPath: filepath.Join(defaultDataDir, "cs.wal", "wal"), TimeoutPropose: 3000 * time.Millisecond, TimeoutProposeDelta: 500 * time.Millisecond, TimeoutPrevote: 1000 * time.Millisecond, @@ -111,7 +112,7 @@ func (cfg *ConsensusConfig) WalFile() string { if cfg.walFile != "" { return cfg.walFile } - return join(cfg.RootDir, cfg.WalPath) + return join(cfg.RootDir, cfg.WALPath) } // SetWalFile sets the path to the write-ahead log file diff --git a/tm2/pkg/bft/consensus/state.go b/tm2/pkg/bft/consensus/state.go index e6b4ace8d2f..fcacb57e229 100644 --- a/tm2/pkg/bft/consensus/state.go +++ b/tm2/pkg/bft/consensus/state.go @@ -122,6 +122,7 @@ type ConsensusState struct { // a Write-Ahead Log ensures we can recover from any kind of crash // and helps us avoid signing conflicting votes wal walm.WAL + walDisabled bool replayMode bool // so we don't log signing errors during replay doWALCatchup bool // determines if we even try to do the catchup @@ -162,6 +163,7 @@ func NewConsensusState( doWALCatchup: true, evsw: events.NewEventSwitch(), wal: walm.NopWAL{}, + walDisabled: config.WALDisabled, } // set function defaults (may be overwritten before calling Start) cs.decideProposal = cs.defaultDecideProposal @@ -294,7 +296,7 @@ func (cs *ConsensusState) OnStart() error { // we may set the WAL in testing before calling Start, // so only OpenWAL if its still the walm.NopWAL - if _, ok := cs.wal.(walm.NopWAL); ok { + if _, ok := cs.wal.(walm.NopWAL); ok && !cs.walDisabled { walFile := cs.config.WalFile() wal, err := cs.OpenWAL(walFile) if err != nil {