fedimint_empty_common/
config.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use fedimint_core::core::ModuleKind;
use fedimint_core::encoding::{Decodable, Encodable};
use fedimint_core::plugin_types_trait_impl_config;
use serde::{Deserialize, Serialize};

use crate::EmptyCommonInit;

/// Parameters necessary to generate this module's configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EmptyGenParams {
    pub local: EmptyGenParamsLocal,
    pub consensus: EmptyGenParamsConsensus,
}

/// Local parameters for config generation
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EmptyGenParamsLocal {}

/// Consensus parameters for config generation
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EmptyGenParamsConsensus {}

impl Default for EmptyGenParams {
    fn default() -> Self {
        Self {
            local: EmptyGenParamsLocal {},
            consensus: EmptyGenParamsConsensus {},
        }
    }
}

/// Contains all the configuration for the server
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct EmptyConfig {
    pub local: EmptyConfigLocal,
    pub private: EmptyConfigPrivate,
    pub consensus: EmptyConfigConsensus,
}

/// Contains all the configuration for the client
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Encodable, Decodable, Hash)]
pub struct EmptyClientConfig {}

/// Locally unencrypted config unique to each member
#[derive(Clone, Debug, Serialize, Deserialize, Decodable, Encodable)]
pub struct EmptyConfigLocal {}

/// Will be the same for every federation member
#[derive(Clone, Debug, Serialize, Deserialize, Decodable, Encodable)]
pub struct EmptyConfigConsensus {}

/// Will be encrypted and not shared such as private key material
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct EmptyConfigPrivate;

// Wire together the configs for this module
plugin_types_trait_impl_config!(
    EmptyCommonInit,
    EmptyGenParams,
    EmptyGenParamsLocal,
    EmptyGenParamsConsensus,
    EmptyConfig,
    EmptyConfigLocal,
    EmptyConfigPrivate,
    EmptyConfigConsensus,
    EmptyClientConfig
);