commonware_consensus/marshal/
config.rs

1use crate::Block;
2use commonware_cryptography::{bls12381::primitives::variant::Variant, PublicKey};
3use commonware_resolver::p2p::Coordinator;
4use commonware_runtime::buffer::PoolRef;
5use governor::Quota;
6use std::num::{NonZeroU64, NonZeroUsize};
7
8/// Marshal configuration.
9pub struct Config<V: Variant, P: PublicKey, Z: Coordinator<PublicKey = P>, B: Block> {
10    /// The public key of the validator.
11    pub public_key: P,
12
13    /// The identity of the network.
14    pub identity: V::Public,
15
16    /// The coordinator for the resolvers.
17    pub coordinator: Z,
18
19    /// The prefix to use for all partitions.
20    pub partition_prefix: String,
21
22    /// Size of backfill request/response mailbox.
23    pub mailbox_size: usize,
24
25    /// Backfill rate limit.
26    pub backfill_quota: Quota,
27
28    /// Minimum number of views to retain temporary data after the application processes a block.
29    ///
30    /// Useful for keeping around information that peers may desire to have.
31    pub view_retention_timeout: u64,
32
33    /// Namespace for proofs.
34    pub namespace: Vec<u8>,
35
36    /// Prunable archive partition prefix.
37    pub prunable_items_per_section: NonZeroU64,
38
39    /// The number of items to store per section in immutable archives.
40    pub immutable_items_per_section: NonZeroU64,
41
42    /// The initial size of the freezer table.
43    pub freezer_table_initial_size: u32,
44
45    /// The frequency (in number of resizes) at which to check if the freezer table
46    /// should be resized.
47    pub freezer_table_resize_frequency: u8,
48
49    /// The number of items to add to the freezer table when resizing.
50    pub freezer_table_resize_chunk_size: u32,
51
52    /// The target size of the freezer journal.
53    pub freezer_journal_target_size: u64,
54
55    /// The compression level to use for the freezer journal.
56    pub freezer_journal_compression: Option<u8>,
57
58    /// The buffer pool to use for the freezer journal.
59    pub freezer_journal_buffer_pool: PoolRef,
60
61    /// The size of the replay buffer for storage archives.
62    pub replay_buffer: NonZeroUsize,
63
64    /// The size of the write buffer for storage archives.
65    pub write_buffer: NonZeroUsize,
66
67    /// Codec configuration for block type.
68    pub codec_config: B::Cfg,
69
70    /// Maximum number of blocks to repair at once
71    pub max_repair: u64,
72}