massa_models/config/
compact_config.rs1use super::*;
2use crate::amount::Amount;
3use massa_time::MassaTime;
4use serde::{Deserialize, Serialize};
5use std::fmt::Display;
6
7#[derive(Debug, Deserialize, Serialize, Clone, Copy)]
9pub struct CompactConfig {
10 pub genesis_timestamp: MassaTime,
12 pub end_timestamp: Option<MassaTime>,
14 pub thread_count: u8,
16 pub t0: MassaTime,
18 pub delta_f0: u64,
20 pub operation_validity_periods: u64,
22 pub periods_per_cycle: u64,
24 pub block_reward: Amount,
26 pub roll_price: Amount,
28 pub max_block_size: u32,
30}
31
32impl Default for CompactConfig {
33 fn default() -> Self {
34 Self {
35 genesis_timestamp: *GENESIS_TIMESTAMP,
36 end_timestamp: *END_TIMESTAMP,
37 thread_count: THREAD_COUNT,
38 t0: T0,
39 delta_f0: DELTA_F0,
40 operation_validity_periods: OPERATION_VALIDITY_PERIODS,
41 periods_per_cycle: PERIODS_PER_CYCLE,
42 block_reward: BLOCK_REWARD,
43 roll_price: ROLL_PRICE,
44 max_block_size: MAX_BLOCK_SIZE,
45 }
46 }
47}
48
49impl Display for CompactConfig {
50 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
51 writeln!(
52 f,
53 " Genesis time: {}",
54 self.genesis_timestamp.format_instant()
55 )?;
56 if let Some(end) = self.end_timestamp {
57 writeln!(f, " End time: {}", end.format_instant())?;
58 }
59 writeln!(f, " Thread count: {}", self.thread_count)?;
60 writeln!(f, " t0: {}", self.t0)?;
61 writeln!(f, " delta_f0: {}", self.delta_f0)?;
62 writeln!(
63 f,
64 " Operation validity periods: {}",
65 self.operation_validity_periods
66 )?;
67 writeln!(f, " Periods per cycle: {}", self.periods_per_cycle)?;
68 writeln!(f, " Block reward: {}", self.block_reward)?;
69 writeln!(f, " Periods per cycle: {}", self.periods_per_cycle)?;
70 writeln!(f, " Roll price: {}", self.roll_price)?;
71 writeln!(f, " Max block size (in bytes): {}", self.max_block_size)?;
72 Ok(())
73 }
74}