fedimint_core/
admin_client.rs

1use std::collections::BTreeSet;
2use std::fmt::Debug;
3
4use serde::{Deserialize, Serialize};
5
6use crate::core::ModuleKind;
7use crate::encoding::{Decodable, Encodable};
8
9/// The state of the server returned via APIs
10#[derive(Debug, Clone, Default, Serialize, Deserialize, Eq, PartialEq, Encodable, Decodable)]
11#[serde(rename_all = "snake_case")]
12pub enum ServerStatusLegacy {
13    /// Server needs a password to read configs
14    #[default]
15    AwaitingPassword,
16    /// Waiting for peers to share the config gen params
17    SharingConfigGenParams,
18    /// Ready to run config gen once all peers are ready
19    ReadyForConfigGen,
20    /// We failed running config gen
21    ConfigGenFailed,
22    /// Config is generated, peers should verify the config
23    VerifyingConfigs,
24    /// We have verified all our peer configs
25    VerifiedConfigs,
26    /// Consensus is running
27    ConsensusRunning,
28    /// Restarted setup. All peers need to sync on this state before continuing
29    /// to `SharingConfigGenParams`
30    SetupRestarted,
31}
32
33/// The state of the server returned via APIs
34#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
35pub enum SetupStatus {
36    /// Waiting for guardian to set the local parameters
37    AwaitingLocalParams,
38    /// Sharing the connection codes with our peers
39    SharingConnectionCodes,
40    /// Consensus is running
41    ConsensusIsRunning,
42}
43
44#[derive(Clone, Debug, Serialize, Deserialize)]
45pub struct SetLocalParamsRequest {
46    /// Name of the peer, used in TLS auth
47    pub name: String,
48    /// Federation name set by the leader
49    pub federation_name: Option<String>,
50    /// Whether to disable base fees, set by the leader
51    pub disable_base_fees: Option<bool>,
52    /// Modules enabled by the leader (if None, all available modules are
53    /// enabled)
54    pub enabled_modules: Option<BTreeSet<ModuleKind>>,
55}
56
57/// Archive of all the guardian config files that can be used to recover a lost
58/// guardian node.
59#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
60pub struct GuardianConfigBackup {
61    #[serde(with = "crate::hex::serde")]
62    pub tar_archive_bytes: Vec<u8>,
63}