oasis_core_runtime/config.rs
1//! Runtime configuration.
2use crate::{common::version::Version, consensus::verifier::TrustRoot, types::Features};
3
4/// Global runtime configuration.
5#[derive(Clone, Debug, Default)]
6pub struct Config {
7 /// Semantic runtime version.
8 pub version: Version,
9 /// Optional trust root for consensus layer integrity verification.
10 pub trust_root: Option<TrustRoot>,
11 /// Storage configuration.
12 pub storage: Storage,
13 /// Advertised runtime features.
14 pub features: Features,
15 /// Whether storage state should be persisted between transaction check invocations. The state
16 /// is invalidated on the next round.
17 pub persist_check_tx_state: bool,
18}
19
20/// Storage-related configuration.
21#[derive(Clone, Debug)]
22pub struct Storage {
23 /// The maximum number of tree nodes held by the cache before eviction.
24 /// A zero value denotes unlimited capacity.
25 pub cache_node_capacity: usize,
26 /// The total size, in bytes, of values held by the cache before eviction.
27 /// A zero value denotes unlimited capacity.
28 pub cache_value_capacity: usize,
29}
30
31impl Default for Storage {
32 fn default() -> Self {
33 Self {
34 cache_node_capacity: 100_000,
35 cache_value_capacity: 32 * 1024 * 1024, // 32 MiB
36 }
37 }
38}