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
use std::collections::BTreeSet;
use std::fmt::Debug;
use serde::{Deserialize, Serialize};
use crate::core::ModuleKind;
use crate::encoding::{Decodable, Encodable};
/// The state of the server returned via APIs
#[derive(Debug, Clone, Default, Serialize, Deserialize, Eq, PartialEq, Encodable, Decodable)]
#[serde(rename_all = "snake_case")]
pub enum ServerStatusLegacy {
/// Server needs a password to read configs
#[default]
AwaitingPassword,
/// Waiting for peers to share the config gen params
SharingConfigGenParams,
/// Ready to run config gen once all peers are ready
ReadyForConfigGen,
/// We failed running config gen
ConfigGenFailed,
/// Config is generated, peers should verify the config
VerifyingConfigs,
/// We have verified all our peer configs
VerifiedConfigs,
/// Consensus is running
ConsensusRunning,
/// Restarted setup. All peers need to sync on this state before continuing
/// to `SharingConfigGenParams`
SetupRestarted,
}
/// The state of the server returned via APIs
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum SetupStatus {
/// Waiting for guardian to set the local parameters
AwaitingLocalParams,
/// Sharing the connection codes with our peers
SharingConnectionCodes,
/// Consensus is running
ConsensusIsRunning,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SetLocalParamsRequest {
/// Name of the peer, used in TLS auth
pub name: String,
/// Federation name set by the leader
pub federation_name: Option<String>,
/// Whether to disable base fees, set by the leader
pub disable_base_fees: Option<bool>,
/// Modules enabled by the leader (if None, all available modules are
/// enabled)
pub enabled_modules: Option<BTreeSet<ModuleKind>>,
/// Total number of guardians (including the one who sets this), set by the
/// leader
pub federation_size: Option<u32>,
}
/// Archive of all the guardian config files that can be used to recover a lost
/// guardian node.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct GuardianConfigBackup {
#[serde(with = "crate::hex::serde")]
pub tar_archive_bytes: Vec<u8>,
}