Skip to content

Commit e82fa1f

Browse files
feat: add NodeConfig.marf_compress, #6593
1 parent b1a4c81 commit e82fa1f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

stackslib/src/config/mod.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,18 @@ pub struct NodeConfig {
21052105
/// ---
21062106
/// @default: `true`
21072107
pub marf_defer_hashing: bool,
2108+
/// Enables on-disk compression for MARF data structures to reduce disk space usage
2109+
/// for chainstate storage.
2110+
///
2111+
/// When set to `true`, MARF trie nodes may be compressed
2112+
/// before being written to disk, trading slightly increased CPU overhead during
2113+
/// reads and writes for reduced storage requirements.
2114+
/// ---
2115+
/// @default: `false`
2116+
/// @notes:
2117+
/// - Compression affects only the on-disk MARF representation; in-memory behavior
2118+
/// remains unchanged.
2119+
pub marf_compress: bool,
21082120
/// Sampling interval in seconds for the PoX synchronization watchdog thread
21092121
/// (pre-Nakamoto). Determines how often the watchdog checked PoX state
21102122
/// consistency in the Neon run loop.
@@ -2424,6 +2436,7 @@ impl Default for NodeConfig {
24242436
prometheus_bind: None,
24252437
marf_cache_strategy: None,
24262438
marf_defer_hashing: true,
2439+
marf_compress: false,
24272440
pox_sync_sample_secs: 30,
24282441
use_test_genesis_chainstate: None,
24292442
fault_injection_block_push_fail_probability: None,
@@ -2588,7 +2601,7 @@ impl NodeConfig {
25882601
hash_mode,
25892602
self.marf_cache_strategy.as_deref().unwrap_or("noop"),
25902603
false,
2591-
)
2604+
).with_compression(self.marf_compress)
25922605
}
25932606
}
25942607

@@ -3836,6 +3849,7 @@ pub struct NodeConfigFile {
38363849
pub prometheus_bind: Option<String>,
38373850
pub marf_cache_strategy: Option<String>,
38383851
pub marf_defer_hashing: Option<bool>,
3852+
pub marf_compress: Option<bool>,
38393853
pub pox_sync_sample_secs: Option<u64>,
38403854
pub use_test_genesis_chainstate: Option<bool>,
38413855
/// At most, how often should the chain-liveness thread
@@ -3911,6 +3925,9 @@ impl NodeConfigFile {
39113925
marf_defer_hashing: self
39123926
.marf_defer_hashing
39133927
.unwrap_or(default_node_config.marf_defer_hashing),
3928+
marf_compress: self
3929+
.marf_compress
3930+
.unwrap_or(default_node_config.marf_compress),
39143931
pox_sync_sample_secs: self
39153932
.pox_sync_sample_secs
39163933
.unwrap_or(default_node_config.pox_sync_sample_secs),

0 commit comments

Comments
 (0)